in reply to Re: What means: exit_value , signal_num and dumped_core
in thread What means: exit_value , signal_num and dumped_core
Firstly, thanks for the reply. So did I understood this right, that in case that the signal_num isn't equal to 0 coredump is having a value too and the child died unexpected?
But I'm still asking myself, why I have to check this on the bitwise-operand way with if ($? & 127)?
Here some sample code:
my $pid = fork( ); if ( defined $pid && $pid == 0 ) { # child system( $_[0]->arg ); if ($? == -1) { return "failed to execute: $!\n"; } elsif ($? & 127) { return "child died with signal %d, %s coredump\n", ($? + & 127), ($? & 128) ? 'with' : 'without'; } else { return "child exited with value " . $? >> 8; } } else { # parent }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: What means: exit_value , signal_num and dumped_core
by Bloodnok (Vicar) on Apr 11, 2014 at 13:02 UTC | |
by Yaerox (Scribe) on Apr 11, 2014 at 13:06 UTC |