computergeek has asked for the wisdom of the Perl Monks concerning the following question:
I have a need to capture STDOUT and STDERR and send both to screen. I am currently using open3 tto pipe to the command and capturing STDOUT, STDERR but I need the output to be sent real time as the child writes it rather than what I am doing now which is printing it after the fact. I see no way of getting open3 to dup the file handle without closing it but this is what I really want. Here is the code snip-it of what I am doing now:
open3 (\*PIPE, ">&PIPEOUT", \*PIPEERR, qq[$Command]) or die "cannot pi +pe to $Command "; print PIPE "Hello, World\n"; close PIPE; $pid2 = waitpid(-1,0); my $ExitCode = $? >> 8; print "ExitCode $ExitCode\n" ; @SpoolFile = <PIPEOUT>; print "SpoolFile @SpoolFile\n"; @CMDERR = <PIPEERR>;
If using IO::Tee and open3 in conjunction solve the issue then I cannot figure out how to do. Would appreciate help.
|
|---|