in reply to Re: Re: why does ignoring sigCHLD corrupt return value from system()?
in thread why does ignoring sigCHLD corrupt return value from system()?
#!/usr/bin/perl use POSIX; if(@ARGV){ $SIG{'CHLD'} = 'IGNORE'; } system('./prog2.pl'); $status=$?; if(WIFEXITED($status)){ print "prog2.pl exited normally, returning ", WEXITSTATUS($status), "\n"; }elsif(WIFSIGNALED($status)){ print "prog2.pl was terminated with signal ", WTERMSIG($status), "\n"; }elsif(WIFSTOPPED($status)){ print "prog2.pl is stopped for signal ", WSTOPSIG($status), "\n"; }else{ print "can't understand what happened to prog2.pl; ", "status is ",$status,"\n"; }
#./prog1.pl prog2.pl exited normally, returning 5 #./prog1.pl ignore prog2.pl was terminated with signal 127Interesting enough, no POSIX signal has number 127, AFAIK... something is not working here.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: why does ignoring sigCHLD corrupt return value from system()?
by fiberhalo (Acolyte) on Nov 05, 2003 at 16:08 UTC | |
by ant9000 (Monk) on Nov 05, 2003 at 17:27 UTC |