Skip to content

9p: exit when stdout or stderr is closed #708

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

rakoo
Copy link

@rakoo rakoo commented Apr 4, 2025

I often use 9p read long/lived/file | short-lived-process in my scripts. When short-lived-process exits, 9p doesn't see it until it tries to write again, which can be in an indeterminate time.

This PR polls stdout and stderr, assumes that a POLLERR means either was closed, and exits. It has been tested on linux only.

To reproduce:

$ 9p read acme/log | sed '/del/q'

sed should stop as soon as an acme window is closed, and that should inform 9p to stop reading the log. Currently it doesn't.

This was referenced Apr 4, 2025
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.

1 participant