in reply to Capturing output from Child processes
I don't know about any Windows weirdness, but have you tried just piping from the command directly?
open(FH, "dir|") or die "Couldn't run dir: $!\n";
Under UNIX, this construct seems to work fine:
#!/usr/bin/perl defined ($pid = open $fh, "-|") or warn $! and last; if ($pid) { # Parent while (<$fh>) { print "OUTPUT: $_"; } } else { # Child exec("/bin/ls"); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Capturing output from Child processes
by Biff (Acolyte) on Aug 06, 2003 at 18:30 UTC |