The exact code looks like:
my( $write, $read, $error, $pid ); if( $is_win32 ) { print "here2\n"; open my $file, "<", $_ or warn "Can't open $_ for read +ing"; #log chomp( my $shebang = <$file> ); close $file; warn "Bad shebang: $shebang - $_" unless $shebang =~ s +/^\#!//; #log #shitty highlighting #warn "$shebang $_"; #log print "here 3\n"; print "$shebang $_",$/; eval{ $pid = open3( $write, $read, $error, $shebang, $ +_ ) }; print "here 4\n"; }
I have buffering turned off and when I run that snippet I get:
here2 here 3 perl usr/test.pl
Where "perl usr/test.pl" is the $shebang $_ line. usr/test.pl looks like:
#!perl print "x" x 489;
If I change the 489 to 488, everything works perfectly. However, this is run from a forked subprocess, which is apparently causing the error, as when I run that open3 line from the command line via perl -e, it works perfectly, so theres something screwy with multiple forks.

For example, this command line invocation seems to (randomly?) hang D:\home\buu\pas>perl -le"use IPC::Open3 qw/open3/; fork; fork; print $$; open3($w, $r, $e, 'perl', 'usr/test.pl'); print <$r>" With test.pl being the same as I quoted above.

In reply to Re^5: win32 open3 strangeness (classic race, no fork) by BUU
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.