cmv has asked for the wisdom of the Perl Monks concerning the following question:
I feel that I should be able to figure this one out, but am hitting a brick wall.
Why does the following give me rc=-1, and if I comment out $SIG{CHLD} then rc=0?
Thanks
-Craig
update: I believe I'm asking the same question that I asked a while ago (although I was using backticks then). Results do seem to vary based on platform. Should this be reported as a perl bug, or do I just need to parse out the reason for the -1 return from $!, as the docs state (thanks Bloodnok++)
use English; use strict; use warnings; use Data::Dumper; # Comment this out and rc=0... $SIG{CHLD} = sub { _lostChild(wait()) }; sub _lostChild { print "_lostChild args:\n", Dumper(\@_), "\n" }; my $rc=system('date'); print STDERR "rc=$rc\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: system() returns -1 with $SIG{CHLD}?
by almut (Canon) on Feb 11, 2009 at 19:53 UTC | |
|
Re: system() returns -1 with $SIG{CHLD}?
by salva (Canon) on Feb 11, 2009 at 20:23 UTC | |
|
Re: system() returns -1 with $SIG{CHLD}?
by Bloodnok (Vicar) on Feb 11, 2009 at 19:29 UTC | |
by ikegami (Patriarch) on Feb 11, 2009 at 19:48 UTC | |
by cmv (Chaplain) on Feb 11, 2009 at 21:48 UTC | |
by ikegami (Patriarch) on Feb 11, 2009 at 22:02 UTC | |
|
Re: system() returns -1 with $SIG{CHLD}?
by salva (Canon) on Feb 12, 2009 at 08:48 UTC | |
|
Re: system() returns -1 with $SIG{CHLD}?
by targetsmart (Curate) on Feb 12, 2009 at 08:10 UTC |