sean finney on 1 Jul 2004 13:43:03 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Mappings background pids to their exit status


On Thu, Jul 01, 2004 at 08:44:03AM -0400, ss396@drexel.edu wrote:
> Right after that, it says -
> If pid is not an active process ID, the  wait  utility  will return immediately and the return code will be 0.

aha.  that might actually be a limitation of the underlying
wait/waitpid/wait4 system call for all i know.

> Now, if the process crashed before the script reaches wait, it would still return the status 0. Thats the problem. I wish there was some other way to directly match the pid of a process against it's exit status.

well, what if you took the portion of the code that actually spawns off
the processes and replaced the backgrounded call to the process with a call 
to something like

( $process;  echo $$:$? > statusfile; ) &

make a call to wait(1) without a pid (to wait for all child processes)
and then grep for :[^0] from statusfile?  


hth
	sean

Attachment: signature.asc
Description: Digital signature