in reply to SIGINT in system() with shell metachars
Programming Perl (page 812) describes the system() return value as follows (for system with a LIST argument):
$exit_value = $? >> 8; $signal_num = $? & 127; # or 0x7f ... $dumped_core = $? & 128; # or 0x80 ...
I.e. the return status is in the HIGH byte, and the signal received, and coredump status, are encoded in the LO byte.
But in the single argument form of system(), I notice that the LO byte has nothing in it. The HIGH byte seems to be encoded as follows:
If $was_interrupted is 0, then $status is the return status of the shell command. If $was_interrupted is 1, then $status is the signal number that interrupted the child shell.$high_byte = $? >> 8; $was_interrupted = $high_byte & 0x80; $status = $high_byte & 0x7f;
I'm posting this because I haven't seen this documented anywhere. Does anyone know this stuff already? Where (if at all) is this documented? Is this a Solaris feature, or a Perl feature??
thanks!
-cadphile
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: SIGINT in system() with shell metachars
by Abigail-II (Bishop) on Jun 25, 2003 at 00:58 UTC | |
|
Re: Re: SIGINT in system() with shell metachars
by andrewc (Acolyte) on Jun 25, 2003 at 13:36 UTC |