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

Fix #11444: remote breaks with stdout redirection #11550

merged 1 commit into from
Sep 13, 2021

Conversation

atykhyy
Copy link
Contributor

@atykhyy atykhyy commented Sep 13, 2021

Fixes #11444.

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.

`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]>
@mheon
Copy link
Member

mheon commented Sep 13, 2021

Preliminary LGTM, but someone more familiar with Windows than me should review

@TomSweeneyRedHat
Copy link
Member

LGTM too, but definitely want a head nod from @jwhonce

@@ -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.

@rhatdan
Copy link
Member

rhatdan commented Sep 13, 2021

/hold
/lgtm
/approve

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 13, 2021
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Sep 13, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Sep 13, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: atykhyy, rhatdan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 13, 2021
@rhatdan
Copy link
Member

rhatdan commented Sep 13, 2021

/hold cancel
Thanks @atykhyy

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 13, 2021
@openshift-merge-robot openshift-merge-robot merged commit cc94914 into containers:main Sep 13, 2021
@atykhyy atykhyy deleted the patch-2 branch September 13, 2021 18:03
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows remote breaks with stdout redirection.
5 participants