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: ensure terminal has required read settings in non-canonical mode #409

Merged
merged 2 commits into from Mar 17, 2022
Merged

fix: ensure terminal has required read settings in non-canonical mode #409

merged 2 commits into from Mar 17, 2022

Conversation

mgabeler-lee-6rs
Copy link
Contributor

@mgabeler-lee-6rs mgabeler-lee-6rs commented Feb 16, 2022

When taking the terminal out of canonical mode, the VMIN and VTIME values become important. The rest of the code in this repo (unsurprisingly) expects the terminal to still operate in blocking read mode. However in some situations, notably in some screen sessions (for unknown reasons), VMIN and VTIME may be set to 0 initially, which produces a range of errors, most commonly "false" EOF reports, but also sometimes panics.

The bug this fixes can be reproduced without messing about with screen simply by running stty min 0 time 0 before running any app that uses this library. A trivial test app I made to debug this issue is available at https://github.com/mgabeler-lee-6rs/survey-screen-eof-demo

fixes #408
see also cli/cli#4739

mislav
mislav approved these changes Feb 16, 2022
Copy link
Collaborator

@mislav mislav left a comment

Thank you! This looks good to me, especially because this is the same approach that golang.org/x/term uses too https://github.com/golang/term/blob/03fcf44c2211dcd5eb77510b5f7c1fb02d6ded50/term_unix.go#L38-L39

@mislav
Copy link
Collaborator

mislav commented Feb 16, 2022

The CI failure is likely intermittent and will probably be resolved by #404

@mgabeler-lee-6rs
Copy link
Contributor Author

mgabeler-lee-6rs commented Feb 16, 2022

OK ... I don't seem to have permission to re-run the CI test to check that, but the tests do pass for me locally

@mislav mislav merged commit 1b28f27 into AlecAivazis:master Mar 17, 2022
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Intermittent False EOF or panic when run under screen
2 participants