> >> my $kid = waitpid($child_pid, 0); >> >> redo if $kid != $child_pid; # So goes back to start of loop from here >> >> unless( 0==$? ) # And never performs this test >> { >> die ("Oh No! An external process has failed!!\n"); >> } >> } >> >> >> That makes most sense to me but I'm not sure how to test if my >> assumption is correct. (I'd have to somehow get the system to return a >> pid/status for a different process) > >In general, you will want to test for errors as soon as possible. If >you get an error, how do you know waitpid will ever work correctly again?
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? Capgemini is a trading name used by the Capgemini Group of companies which includes Capgemini UK plc, a company registered in England and Wales (number 943935) whose registered office is at No. 1 Forge End, Woking, Surrey, GU21 6DB. This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/