ruby - how can a process be killed with all its childern -


i have situation 1 xterm runs xterm runs process. set kind of watchdog , kill windows in case of stuck process.

i'm using ruby this. when first xterm opened it's pid, , later when sigterm sent it, first xterm window dies, not second.

it can reproduced in irb:

irb(main):002:0> cmd = "xterm -e xterm -e sleep 1000" => "xterm -e xterm -e sleep 1000" irb(main):003:0> pid = process.spawn(cmd) => 669 irb(main):004:0> process.kill(15, 669) => 1 

this leaves second xterm window open. how can process chain killed?

thanks

using either ps xf or pstree, can dynamically see running processes hierarchy.

i've used strace track behaviour of programs. turned checking contents of /proc/$pid/stat , /proc/$pid/status, give them information of process's parent is.

probably, have processes parent pid equal pid got (or process's ppid).


Comments

Popular posts from this blog

many to many - Django Rest Framework ManyToMany filter multiple values -

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

Java Entity Manager - JSON reader was expecting a value but found 'db' -