Sends the given signal to the specified process id(s) if pid is
positive. If pid is zero signal is sent to all processes
whose group ID is equal to the group ID of the process. signal may
be an integer signal number or a POSIX signal name (either with or without
a SIG prefix). If signal is negative (or starts with
a minus sign), kills process groups instead of processes. Not all signals
are available on all platforms.
pid = fork do
Signal.trap("HUP") { puts "Ouch!"; exit }
# ... do some work ...
end
# ...
Process.kill("HUP", pid)
Process.wait
produces:
Ouch!
If signal is an integer but wrong for signal,
Errno::EINVAL or RangeError will be raised.
Otherwise unless signal is a String or a
Symbol, and a known signal name, ArgumentError
will be raised.
Also, Errno::ESRCH or RangeError for invalid
pid, Errno::EPERM when failed because of no
privilege, will be raised. In these cases, signals may have been sent to
preceding processes.
Please login to continue.