How can I use Trapping signals in Windows?


#1

Hi, all

  I am using ruby 1.8.6-26 in Windows and I want to trapping

siganls in a process, like


Deamon Process:

loop do
Signal.trap(“USR1”) do
puts “catch signal”
do some work…
end
sleep 1
end


But when running the code, it reported the error:
–in `trap’: unsupported signal SIGUSR1 (ArgumentError)

It seems some signals aren’t supported by windows.
Then I replaced “USR1” to “EXIT”, the code passed.
But when I used “Process.kill(“EXIT”, pid)” in irb, it repors error:
–ArgumentError: unsupported name `SIGEXIT’
Then I used “Process.kill(0, pid)” instead, it retruns 1 without
“catch signal”
Then I entered “Ctrl-C”, “catch signal” appeared.

So how can I use Signal.trap sucessfully in windows ?
If the signal delivery may not be reliable, which mechanism can I use
to control the process?

Thanks
Jarod Z.