Skip to content

Commit

Permalink
Fix containers#11444: remote breaks with stdout redirection
Browse files Browse the repository at this point in the history
`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 <[email protected]>
  • Loading branch information
atykhyy authored and mheon committed Sep 20, 2021
1 parent d4d9bcc commit c957672
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/terminal/console_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c957672

Please sign in to comment.