An excellent example that makes it pretty clear what is going on, thanks. I am still puzzled though, the die runs in the child but how did the die get in there ? Is open3 forking and if so how does it decide to run the die but not the following print which comes only from the parent. Is there any way in the parent to trap failure of the child ?

# here the die runs in the child: nph>perl -MIPC::Open3 -le'print "dad: $$";eval {$pid = open3(*IN, *OUT +, *ERR, @ARGV);}; die "$$ ACK $@\n" if ($@);print <ERR>' nosuch dad: 62718 55596 ACK open3: exec of nosuch failed at -e line 1 # yet here in the same code it runs in the parent !!! nph>perl -MIPC::Open3 -le'print "dad: $$";eval {$pid = open3(*IN, *OUT +, *ERR, @ARGV);}; die "$$ ACK $@\n" if ($@);print <ERR>' dad: 25600 25600 ACK open3(*main::IN, *main::OUT, *main::ERR): not enough argumen +ts at -e line 1 # and if I remove the print <ERR> I alter the behaviour again nph>perl -MIPC::Open3 -le'print "dad: $$";eval {$pid = open3(*IN, *OUT +, *ERR, @ARGV);}; die "$$ ACK $@\n" if ($@);print "moo" ' nosuch dad: 55592 moo nph>

Thanks,
R.

Pereant, qui ante nos nostra dixerunt!

In reply to Re^2: delayed die and open3 by Random_Walk
in thread delayed die and open3 by Random_Walk

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.