IPC::Open3 doesn't use fork on Win32.
This is the classic race condition inherent in using open3. The subprocess is blocking waiting for the output to be read and so isn't reading while the parent is blocked writing to the subprocess waiting for the subprocess to read. Or the subprocess is blocking reading while the parent is blocking reading output that the subprocess has buffered and so isn't available for reading yet. And there is no good way to get around this because you can't tell if you are going to end up in the first deadlock case or the second.
Using select could help except select doesn't work on non-sockets in Win32. You could use a Win32::SelectablePipe instead of pipe except that I don't think the (broken) snippet from tye's scratchpad has been turned into a CPAN module yet by my minions. ;)
- tye
In reply to Re^2: win32 open3 strangeness (classic race, no fork)
by tye
in thread win32 open3 strangeness
by BUU
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |