in reply to open(KID, "-|") and wait()?
That way, whatever else the parent is doing, it will normally always catch a SIGCHLD. The only exception to this is if the parent is in uninterruptible sleep (e.g. when it's waiting on an NFS op on a filesystem whose server has gone away) - then it becomes night of the living dead :).$SIG{'CHLD'}=sub { my $pid=wait(); if ($pid == -1 ) { print "SIGCHLD handler called without dead child.\n"; return; } print "Child $pid exited with $?\n"; }
Update: In the case of an open()ed child, as apparently the OP is using (bad robartes, I had parsed the snippet as a standard fork and exec), see Improv's remark. However, installing a SIGCHLD handler can never hurt, for example in the case where the child process abnormally (or even normally) terminates before the parent closes the filehandle.
CU
Robartes-
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Re: open(KID, "-|") and wait()?
by merlyn (Sage) on Apr 11, 2003 at 14:15 UTC | |
|
Re: Re: open(KID, "-|") and wait()?
by pemungkah (Priest) on Apr 11, 2003 at 15:22 UTC | |
|
Re: Re: open(KID, "-|") and wait()?
by pg (Canon) on Apr 11, 2003 at 03:41 UTC | |
by virtualsue (Vicar) on Apr 11, 2003 at 09:30 UTC | |
by robartes (Priest) on Apr 11, 2003 at 05:43 UTC |