Nobuyoshi Nakada
4/22/2007 12:06:00 AM
Hi,
At Sun, 22 Apr 2007 01:03:51 +0900,
Elliott Hird wrote in [ruby-talk:248642]:
> I have this code:
>
> Process.waitpid(fork { exec "stuff" })
>
> Outside of the fork, how can i detect various signals sent to stuff?
> SIGSEV, etc.
You can detect how the child process exited with $?, or waitpid2.
$ ruby -e 'pid = fork {exec "sleep 10"}; sleep 0.1; Process.kill("TERM", pid); p Process.waitpid2(pid)'
[23366, #<Process::Status: pid=23366,signaled(SIGTERM=15)>]
--
Nobu Nakada