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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.