M
Martin aus Chemnitz
Hi!
I know, this question was asked a dozen times, but I can't believe that
Ruby does not offer a suitable solution. I therefore write this posting
more in the spirit of an urgent feature request.
Under Windows, I want to start an external program and kill it on
exitting my Ruby script.
begin
$t = Thread.new { system("everlasting") }
...
ensure
$t.kill
end
does not stop the everlasting program, it stops $t, not its child
processes. Such a command is urgently needed!
Yukihiro Matsumoto writes in
I would be glad if such a feature could be implemented. (Or, of course,
if anyone can tell me suitable solution.)
Martin
I know, this question was asked a dozen times, but I can't believe that
Ruby does not offer a suitable solution. I therefore write this posting
more in the spirit of an urgent feature request.
Under Windows, I want to start an external program and kill it on
exitting my Ruby script.
begin
$t = Thread.new { system("everlasting") }
...
ensure
$t.kill
end
does not stop the everlasting program, it stops $t, not its child
processes. Such a command is urgently needed!
Yukihiro Matsumoto writes in
but I think I can't get the PID of a system call either.If you want to kill child processes when the thread is down,
th = Thread.new{
Thread.current[:children] = []
begin
... add child processes to Thread.current[:children]
ensure
Process.kill("TERM", *Thread.current[:children])
end
}
I would be glad if such a feature could be implemented. (Or, of course,
if anyone can tell me suitable solution.)
Martin