From: Robert Klemme Date: 2009-12-27T02:55:15+09:00 Subject: Re: How to know if a process is zombie? On 26.12.2009 17:53, Iņaki Baz Castillo wrote: > Hi, after some forks I need to know if a process still is alive or not, but in > case it's alive I also need to know if it's a zombie process (it died without > Process.wait or Process.detach). > > Unfortunatelly I couln't find how to know it using Process module: > http://ruby-doc.org/core/classes/Process.html > http://ruby-doc.org/core/classes/Process/Status.html > > Is there any other way to determine if a given PID is zombie? I believe you can use Process.kill(0, suspicious_pid) and if you get "Errno::ESRCH: No such process" it does not exist any more or is a zombie. Then you can use Process.waitpid(suspicious_pid, Process::WNOHANG) to end his martyrdom and get the exit code. It's probably better to set up a signal handler though. But that totally depends on your use case. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/