From: Masschelein Bart Date: 2005-07-05T21:18:06+09:00 Subject: Re: Abort a system call > > With parts of other pieces today on the reflector, I assembled this > > -------- > pid = Process.fork do > exec($decoder, $bitstreamPath, $yuvOutputPath) > end > > trap "SIGINT", proc{ Process.kill("SIGINT", pid); print "^C > was pressed. Process id #{pid}\n" } > > Process.waitpid(pid) > -------- > > The trap gets executed, meaning that I get the output of the > print, during the execution of my program, and the pid > matches the one from the process status list. However the > first part (Process.kill("SIGINT", pid);) is not executed > correctly, or at least does not do what I expected, killing > the process. Is there another way to kill a process from > Ruby? Or do I need another signal # instead of "SIGINT" > there? No clue... > For those having similar problems, I just solved it by trap "INT", proc{ Process.kill(9, pid) } so using a hard kill. If people have more elegant ways of solving this, let me know! CU B