cpan-authors / IPC-Run

https://metacpan.org/pod/IPC::Run
Other
21 stars 38 forks source link

Retry _read() on EINTR, instead of losing pipe contents. #177

Closed nmisch closed 1 month ago

nmisch commented 1 month ago

By not retrying, EINTR behaved like EOF. In other words, EINTR had consequences like the write side (kid side) closing the pipe early. Symptoms depended on the _read() caller. When $pipe_reader conflated EINTR with pipe closure, symptoms were application-specific. When _spawn reading the internal "sync pipe" conflated EINTR with pipe closure, the parent would fail to report exec failure. Add a test for the loss of exec failure report. The $pipe_reader problem is much tougher to test, because $pipe_reader only tries read() if select() found data available. Hence, the signal needs to arrive in the narrow window after read() enters the kernel, before read() returns already-available data. The issue report reproduced that on macOS only.

Fixes https://github.com/cpan-authors/IPC-Run/issues/176