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

tty: stop spamming VEOF on raw terminals, and cleanly handle EOF #97

Merged
merged 2 commits into from
Jun 28, 2024

Conversation

Snaipe
Copy link
Member

@Snaipe Snaipe commented Jun 28, 2024

This PR contains two changes:

The first one is a change in how we handle hangups from stdin; if the child pty is not in raw mode (or rather, is in non-canonical mode), and therefore isn't interpreting VEOF, then we won't send any. Instead, we now just hang up the terminal, which causes the session to die with a SIGHUP.

The second fixes a weirdity I noticed where we would not handle EOF properly, and commands like bst --tty cat </dev/null would not terminate.

There is no point in sending VEOF on PTYs that aren't interpreting them.

Simply hanging up and letting the session get killed with SIGHUP is the right
thing to do.
The old code would loop forever trying to read 0 bytes and thinking that
the input fd was read-ready. This is normally not an issue, but because
we're emulating regular files as eventfds (since epoll won't support
them), things like bst --tty cat </dev/null would never terminate.
@Snaipe Snaipe merged commit 2461d3d into aristanetworks:main Jun 28, 2024
3 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.

2 participants