cpan-authors / IPC-Run

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

On Windows, avoid hang under IPCRUNDEBUG. #157

Closed nmisch closed 2 years ago

nmisch commented 2 years ago

In #156, I wrote:

For anyone experimenting with this, beware of heisenbugs when using IPCRUNDEBUG. The POSIX::close() calls in _map_fds can hang the same way. I will propose a fix for that separately.

Here's that fix. The POSIX ways of testing whether a FD is open don't work on for Perl on Windows, so I used Win32API::File::FdGetOsFHandle(). That turned into a bit of a yak shave, because our existing FdGetOsFHandle() calls don't detect failure on 64-bit Windows. The first commit of this PR fixes the existing calls, and the second commit fixes $SUBJECT.

nmisch commented 2 years ago

I didn't adopt the read approach for Windows, because https://www.gnu.org/software/gnulib/manual/html_node/read.html says to expect crashes. I didn't alter the non-Windows approach; I just moved it from one subroutine to another. I agree read sounds attractive for non-Windows, but I think an attempt to adopt it would belong in a separate pull request.

nmisch commented 2 years ago

I plan to hold this until after the release.