perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ed Grimm <edgr...@dsblade00.wat.us.ray.com>
Subject Re: handling system call exit status
Date Mon, 18 Jul 2005 17:19:15 GMT
$SIG{CHLD} = sub {};

If that doesn't work, see perlipc(1) for details on how to write a
reaper.  Note that, with the above reaper, you will need to explicitly
wait for any fork() calls when it is time for them to complete.

Also note that it's possible something is playing with $SIG{CHLD}, which
could produce the intermittent results you're seeing.

Ed

On Mon, 18 Jul 2005, Daniel wrote:

> Hi,
>
> Setting $SIG{CHLD} = 'IGNORE' works intermittently, and I'm guessing
> that's because now I'm ignoring the status all together sometimes.
>
> Better then before, but rather unreliable. I tried some variations with
> $SIG{CHLD} but no improvements over just using 'IGNORE'.
>
> Thanks for the tip. Any more/other ideas how I could get a successful and
> reliable indication every time?
>
> Daniel
>
> On Mon, Jul 18, 2005 at 03:17:42PM +0000, Ed Grimm wrote:
>> On Fri, 15 Jul 2005, Daniel wrote:
>>
>>> Sometimes I see strange numbers when handling exit status from
>>> system calls.
>>>
>>>     my $out = `$cmd`;
>>>     my $stat = $? >> 8;
>>>
>>> and $stat may contain anumber like  16777215 at this point, whereas
>>> on commandline it would be more like 2, or no error at all (0).
>>
>> I'd think it would always be 16777215 in this situation.  I believe
>> your children are being automatically reaped, as described in the
>> perlfunc manpage under wait (system references wait as the source of
>> its return code.)  IIRC, to get perl to stop auto-reaping ones
>> process children, one sets $SIG{CLD} to a reap function.
>>
>> Ed

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message