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: handle polls with both POLLIN and POLLHUP #9

Merged
merged 1 commit into from
Dec 18, 2024

Conversation

limeytexan
Copy link
Contributor

The behaviour of poll() seems to differ between Linux and Darwin when the child process has closed the pipe and poll() returns both POLLIN and POLLHUP set on the returned events value. On Linux this is a sign that we can read from the pipe one more time, but on Darwin it seems that POLLIN remains set after the final read so we need to add extra logic to make sure to stop polling for POLLIN after a failed read in the presence of POLLHUP.

Also fix minor formatting issues introduced by Devin.

The behaviour of poll() seems to differ between Linux and Darwin when the
child process has closed the pipe and poll() returns both POLLIN and POLLHUP
set on the returned events value. On Linux this is a sign that we can read
from the pipe one more time, but on Darwin it seems that POLLIN remains set
after the final read so we need to add extra logic to make sure to stop
polling for POLLIN after a failed read in the presence of POLLHUP.

Also fix minor formatting issues introduced by Devin.
@limeytexan limeytexan merged commit 813ed22 into main Dec 18, 2024
4 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.

1 participant