clintonm9 has asked for the wisdom of the Perl Monks concerning the following question:
Thanks#!/usr/bin/perl use Data::Dumper; use IO::CaptureOutput qw/capture_exec/; # The first test shows the Success = 1 &runCommand(); # Now the same thing in a child process shows Success = 1 unless ( $pid = fork ) { &runCommand(); exit; } # Now child process with IGNORE set, shows Success = 0 $SIG{CHLD} = 'IGNORE'; unless ( $pid = fork ) { &runCommand(); exit; } sub runCommand { ($stdout, $stderr, $success, $exit_code) = capture_exec('perl', '- +e', 'print "Test"'); print "stdout: $stdout\n"; print "stderr: $stderr\n"; print "Success: $success\n"; print "exit code: $exit_code\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using IO::CaptureOutput in a child process to caputre STDOUT and STDERR
by Khen1950fx (Canon) on Apr 10, 2011 at 08:57 UTC | |
by Marshall (Canon) on Apr 10, 2011 at 19:16 UTC | |
by Anonymous Monk on Apr 10, 2011 at 22:30 UTC | |
by Marshall (Canon) on Apr 10, 2011 at 23:12 UTC | |
by Anonymous Monk on Apr 10, 2011 at 23:18 UTC | |
|