Skip to content

fix: handle polls with both POLLIN and POLLHUP#9

Merged
limeytexan merged 1 commit into
mainfrom
fix/handle-POLLIN+POLLHUP
Dec 18, 2024
Merged

fix: handle polls with both POLLIN and POLLHUP#9
limeytexan merged 1 commit into
mainfrom
fix/handle-POLLIN+POLLHUP

Conversation

@limeytexan

Copy link
Copy Markdown
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.
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