Re: Monitoring multiple child processes
- From: shawnhcorey@xxxxxxxxx (Shawn H Corey)
- Date: Mon, 09 Nov 2009 13:06:03 -0500
Taylor, Andrew (ASPIRE) wrote:
OK, I'm clearly being dense here then. My understanding was that the
"$?" contained the status of the pid returned by waidpid.
If waitpid returned a pid from some other process (i.e. not one of my
children) that had failed (i.e return status other than 0) then wouldn't
my test abort the script when it wouldn't need to (as the process that
failed wasn't one of my children) before it got to the redo?
Or have I firmly grasped the wrong end of the stick?
On some systems, waitpid may return something rather than a child pid or
-1. This would happen when the wait was interrupted by something other
than a child death. Most likely, it would be zero.
The return status, $?, is a 16-bit word of three packed values. See
`perldoc perlvar` and search for /\$\?/. It should be set to a non-zero
value by the child if the child does not terminate successfully. Most
UNIX commands do this; most user-written scripts do not. Also, Windows
ignores the return value and always returns zero.
$? should not change unless a child process died.
--
Just my 0.00000002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
I like Perl; it's the only language where you can bless your
thingy.
.
- Follow-Ups:
- RE: Monitoring multiple child processes
- From: Andrew Taylor
- RE: Monitoring multiple child processes
- References:
- Monitoring multiple child processes
- From: Andrew Taylor
- Re: Monitoring multiple child processes
- From: Shawn H Corey
- RE: Monitoring multiple child processes
- From: Andrew Taylor
- Re: Monitoring multiple child processes
- From: Shawn H Corey
- RE: Monitoring multiple child processes
- From: Andrew Taylor
- Monitoring multiple child processes
- Prev by Date: Re: splitting and replacing characters
- Next by Date: Re: How to catch the DBI module error message
- Previous by thread: RE: Monitoring multiple child processes
- Next by thread: RE: Monitoring multiple child processes
- Index(es):
Relevant Pages
|