From: Sam Roberts Date: 2006-06-05T08:50:23+09:00 Subject: Re: Please kill the children as you're leaving Quoting lutzky@gmail.com, on Sun, Jun 04, 2006 at 10:15:08PM +0900: > Allow me to clarify the problem. Say I use irb as follows: > > fork do > { } while true > end > => SOME_PID > > Now, if I kill (externally) the parent irb, then SOME_PID dies along > with it. However, if instead of doing that, I > > raise Exception > > Then the child lives, reparanted to init. How do I avoid that? Non with irb, but you may be able to make the parent a session leader, which might cause SIGHUP to be delivered to its children when it exits. Do some reading on sessions, setsid(), and forground process groups. Other ways would depend on why you want to do this. You could create a pipe, and have all your children keep a thread blocked on the read end of it, so when the parent dies, the write end is closed, and all the read ends return with an error. Sam