Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

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

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

Copy link
Collaborator

@mislav mislav left a comment

Choose a reason for hiding this comment

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

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

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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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