Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #11444: remote breaks with stdout redirection #11550

Merged
merged 1 commit into from
Sep 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we check for specific error here, like NotATerminal or something like rhat?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Golang standard library doesn't think it's worth the bother, and I agree. The only thing about the handle the code here is interested in is whether it makes sense to call SetConsoleMode on it to turn on VT mode. If standard handles are terminal handles but there is something else wrong with them that makes GetConsoleMode return an error, the terminal will just remain in dumb mode and the error will come up a bit later when trying to read or write to them. IMO this is reasonable behavior.

}
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