From: Mark Slagell Date: 2002-05-06T04:09:38+09:00 Subject: Re: defunct child process neil wrote: >Mark Slagell wrote: > > >>neil wrote: >> >> >> >>>neil wrote: >>> >>> >>> >>> >>>>I cannot claim this the correct way, >>>>though it is based on some Pick Axe >>>>code, >>>> >>>> >>>> >>>> >>>Sorry that got mangled, >>> >>>trap("CLD"){ # child finished >>> begin >>> waitpid(Process.wait, >>>Process::WNOHANG) >>> rescue StandardError >>> break >>> end >>> } >>> >>>and get the Procees.uid if you want to >>> >>> >>> >>> >>Or you might find it sufficient to say >> >>trap('CLD') {Process.wait2} >> >> -- Mark >> >> > > True, though without the rescue you can >get an fatal error > with Process.wait2, "failed to convert >array into an integer" > and again fatal with >Process.wait::WNOHANG No child processes >(Errno::ECHILD) > The break is redundant, sorry is a bit >of left over code. > > Neil > > Neil, I'm not sure where the array conversion error could come from (have you seen it happen?). If a bogus SIGCHLD signal came through, I see that wait2 should still fail with "No child processes," but can we not trust the OS about that? Under what circumstances would there ever be a SIGCHLD signal and no child to go along with it? Mark