ecomeau has asked for the wisdom of the Perl Monks concerning the following question:
my $cmd = 'java -jar bogus.jar > bogus.log 2>&1 &'; system($cmd) == 0 or die "Failed to run command: [$cmd]\n"; if ($? == -1) { print "failed to execute: $!\n"; } elsif ($? & 127) { printf "child died with signal %d, %s coredump\n", ($? & 127), ($? & 128) ? 'with' : 'without'; } else { printf "child exited with value %d\n", $? >> 8; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: How to capture system return code when command launched in the background?
by moritz (Cardinal) on May 02, 2010 at 12:16 UTC | |
Re: How to capture system return code when command launched in the background?
by ikegami (Patriarch) on May 02, 2010 at 16:38 UTC | |
Re: How to capture system return code when command launched in the background?
by samarzone (Pilgrim) on May 03, 2010 at 06:27 UTC | |
by Anonymous Monk on May 03, 2010 at 09:43 UTC | |
by afoken (Chancellor) on May 03, 2010 at 14:53 UTC |