mmartin has asked for the wisdom of the Perl Monks concerning the following question:
OUTPUT ERRORS FROM 'open()' COMMAND:--------------------------------------------------------------------- my $proc = Proc::Background->new($bg_script, "$ARG1", "$ARG2"); my $PID = $proc->pid; # Get the PID my $start_time = $proc->start_time; # Get the Start Time # Check if the Job is still alive... 1==YES, 0==NO my $alive = $proc->alive; # While $alive is NOT '0', the process is still running while($alive ne 0) { # Check again if it's still running... $alive = $proc->alive; # This while loop will force Perl::Gtk2 to continue # processing GUI Events while BG process continues executing... while (Gtk2->events_pending) { Gtk2->main_iteration; } Gtk2::Gdk->flush; # Sleep for 1000 milliseconds usleep(1000); } # Capture the Exit Status from Background Script my $socket_RETCODE = $proc->wait; # Divide RETCODE by 256 to get actual RETCODE $socket_RETCODE /= 256; ########################################################### ### Attempt to Capture the OUTPUT: open( PROC, "$proc" ) or die "Can't read from $proc: $!\n"; my $output = print PROC; ########################################################### ---------------------------------------------------------------------
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Capturing STDOUT and/or STDERR from Proc::Background
by Anonymous Monk on Aug 09, 2013 at 03:07 UTC | |
by mmartin (Monk) on Aug 09, 2013 at 14:28 UTC | |
by Anonymous Monk on Aug 10, 2013 at 10:05 UTC | |
by mmartin (Monk) on Aug 12, 2013 at 14:16 UTC |