in reply to Re^2: Synchronizing STDERR and STDOUT
in thread Synchronizing STDERR and STDOUT
This is precisely the type of plumbing that a shell will do when you say 2>&1, except without the unportable syntax ;-)pipe CHILDREAD, CHILWRITE; defined( my $pid = fork ) or die "fork: $!"; if ( $pid ) { # read on CHILDREAD; } else { open STDERR, ">&CHILDWRITE"; open STDOUT, ">&CHILDWRITE"; exec( $somecmd ); }
That said, IPC::Run and friends already abstract all of this out, so there's no need to reinvent the wheel.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Synchronizing STDERR and STDOUT
by Ovid (Cardinal) on Sep 21, 2006 at 11:12 UTC | |
by nothingmuch (Priest) on Sep 21, 2006 at 11:20 UTC |