From: ara howard Date: 2008-02-02T13:22:05+09:00 Subject: Re: Child processes live after parent process is killed On Feb 1, 2008, at 4:45 PM, Gary Wright wrote: snip helpful explaintion... > Ara, are you talking more about making sure that you are reaping > child processes? The idea that your child process will outlive you > is quite common, for example when a daemon is started. It will often > outlive whatever started it. well - i wasn't really talking about reaping, but killing ;-) the only way i've found to *really* prevent a child from outliving it's parent is what slave.rb does internally which connect a lifeline from child to parent - that lifeline is a pipe. the basic concept is (with syntax error i'm sure) r, w = IO.pipe fork do w.close Thread.new do begin r.read rescue Exception Kernel.exit end end child_stuff() exit end r.close which is to say open a pipe, spawn a child, ensure the child exist if the pipe ever goes stale. this makes a child die even if the parent gets 'kill -9'ed cheers. a @ http://codeforpeople.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama