cmv has asked for the wisdom of the Perl Monks concerning the following question:
Try this test program on *nix and see if it happens to you too...
my $ret1 = `date`; my $exit1 = $?; print STDERR "exit1=$exit1 ret1=$ret1"; my $pid; if($pid = fork) { $SIG{CHLD} = sub {wait}; print STDERR "$$: parent pid=$pid\n"; }elsif (defined $pid) { print STDERR "$$: child\n"; setpgrp(0, $$); exec "exec sleep 500 &" || die "Bad exec $!"; exit; } foreach my $i (1..5) { my $ret2 = `date`; my $exit2 = $?; print STDERR "exit2=$exit2 ret2=$ret2"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: $? stuck returning -1...
by jettero (Monsignor) on Jun 20, 2007 at 15:52 UTC | |
by cmv (Chaplain) on Jun 20, 2007 at 16:05 UTC | |
by Joost (Canon) on Jun 20, 2007 at 20:25 UTC | |
|
Re: $? stuck returning -1...
by ikegami (Patriarch) on Jun 20, 2007 at 16:31 UTC | |
by cmv (Chaplain) on Jun 20, 2007 at 20:27 UTC |