> When I do in Perl sth like
>
> system "$decoder $bitstreamPath $yuvOutputPath";
>
> I can interrupt the execution with ctrl-c. The Ruby script does what
> it is expected to, but I cannot interrupt the program with ctrl-c
> anymore, and have to wait until the execution is finished.Without trying out: maybe you have to explicitely set a
signal handler for
SIGINT that then terminates the child process. Could be that
perl does it
automatically for you.
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...
regards,
Bart.