On Thu, 1 Mar 2007, Andreas S wrote: > how do you check if your child process from fork still alive or not? In perl > I can send kill(0, $cid), I think. But Process.kill(0, child_id) always > returns 1. > > To be honest, I couldn't get the perl code to work either. It always returns > 1 too. > > I can do `ps -p #{child_id}` but I wonder if Process.kill should work too. > > -andre > > _________________________________________________________________ > Win a ZuneŃ÷make MSNĄç your homepage for your chance to win! > http://homepage.msn.com/zune?icid=hmetagline > > # # returns true if pid is running, false otherwise # def alive pid #--{{{ pid = Integer("#{ pid }") begin Process::kill 0, pid true rescue Errno::ESRCH false end #--}}} end alias alive? alive it should always return 1. it raises if the pid is dead or you do not have permission to signal the process. -a -- be kind whenever possible... it is always possible. - the dalai lama