The parent is printing, the child is dying. Try this:
use strict;
use warnings;
use IPC::Open3;
$|=1;
print "parent pid: $$\n";
my($in, $out, $err, $pid);
# duplicate stderr and stdout
open( $out, ">&STDOUT" ) or
die "Can't dup STDOUT to OUTPUT: $!\n";
open( $err, ">&STDERR" ) or
die "Can't dup STDERR to OUTERR: $!\n";
eval { $pid = open3($in, $out, $err, @ARGV) };
die "$$ open3 gave trouble: $@\n" if $@;
print "$$ It is running\n";
close $in;
print "stdout:\n";
print while <$out>;
close $out;
print "$$ stderr:\n";
print "$$ $_" while <$err>;
close $err;
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|