in reply to Re^2: Capture STDOUT and send to screen with open3
in thread Capture STDOUT and send to screen with open3
Could you provide a code snipit of how to accomplish?
Something like this maybe?
Update: Now with STDERR support.
use warnings; use strict; use IPC::Run qw/ run new_chunker /; my @cmd = ('yourcommand', 'arg1', 'arg2'); my (@out,@err); run \@cmd, '>', new_chunker("\n"), sub { my $line = shift; print $line; push @out, $line; }, '2>', new_chunker("\n"), sub { my $line = shift; print STDERR $line; push @err, $line; } or die $?;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Capture STDOUT and send to screen with open3 (updated)
by karlgoethebier (Abbot) on Mar 06, 2018 at 11:33 UTC | |
|
Re^4: Capture STDOUT and send to screen with open3 (updated)
by computergeek (Novice) on Mar 05, 2018 at 18:10 UTC | |
by haukex (Archbishop) on Mar 05, 2018 at 18:20 UTC |