From c23f81fab6183892a3565e6b2a818ad9db22421c Mon Sep 17 00:00:00 2001 From: Anton Tykhyy Date: Mon, 13 Sep 2021 17:42:48 +0300 Subject: [PATCH] Fix #11444: remote breaks with stdout redirection `setConsoleMode` should do nothing if the handle is not a terminal. The proposed change is [exactly what `golang.org/x/term/IsTerminal()` does on Windows](https://cs.opensource.google/go/x/term/+/6886f2df:term_windows.go). [NO TESTS NEEDED] Signed-off-by: Anton Tykhyy --- pkg/terminal/console_windows.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/terminal/console_windows.go b/pkg/terminal/console_windows.go index 08e66cb3a0..9a636d681e 100644 --- a/pkg/terminal/console_windows.go +++ b/pkg/terminal/console_windows.go @@ -25,7 +25,7 @@ func setConsoleMode(handle windows.Handle, flags uint32) error { var mode uint32 err := windows.GetConsoleMode(handle, &mode) if err != nil { - return err + return nil // not a terminal } if err := windows.SetConsoleMode(handle, mode|flags); err != nil { // In similar code, it is not considered an error if we cannot set the