From: ara.t.howard@... Date: 2006-07-12T07:01:20+09:00 Subject: Re: killing off a process tree On Wed, 12 Jul 2006, Erich Lin wrote: > Is there a command in ruby that when given the pid , it will terminate > all children processes of that pid including itself. > > It seems that Process.kill(9, pid) only kills the parent and not the > children. harp:~ > ri Process.kill ----------------------------------------------------------- Process#kill Process.kill(signal, pid, ...) => fixnum ------------------------------------------------------------------------ Sends the given signal to the specified process id(s), or to the current process if _pid_ is zero. _signal_ may be an integer signal number or a POSIX signal name (either with or without a +SIG+ prefix). If _signal_ is negative (or starts with a minus sign), kills process groups instead of processes. Not all signals are available on all platforms. pid = fork do Signal.trap("HUP") { puts "Ouch!"; exit } # ... do some work ... end # ... Process.kill("HUP", pid) Process.wait _produces:_ Ouch! -a -- suffering increases your inner strength. also, the wishing for suffering makes the suffering disappear. - h.h. the 14th dali lama