- Notifications
You must be signed in to change notification settings - Fork1.1k
fix: macOS pty race with dropped output#7278
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Signed-off-by: Spike Curtis <spike@coder.com>
mafredri left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This seems fine, with a caveat.
Also, why can’t we have good things? 😄
| iferr:=opty.tty.Close();err!=nil { | ||
| _=cmd.Process.Kill() | ||
| returnnil,nil,xerrors.Errorf("close tty: %w",err) | ||
| ifruntime.GOOS=="linux" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I wonder if, down the line, this might give us a bad time trying to support other OSs (e.g. BSD variants).
I found a SO post that confirms Darwin like behavior on FreeBSD (8.2) as well, but apparently the behavior may be closer to Linux in 10.0 which could mean we may block on output copy.
https://stackoverflow.com/a/25123701
A comment mentions checkingtcgetattr on master to decide if we keep both ends open but no idea hire reliable that is:https://stackoverflow.com/questions/23458160/final-output-on-slave-pty-is-lost-if-it-was-not-closed-in-parent-why/25123701#comment36273878_23458160
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It definitely might!
But, the unit test we have should fail if the BSD version we intend to support acts like Linux and doesn't get the close, so I guess we'll just cross that bridge if we come to it.
No description provided.