# How can I use Trapping signals in Windows?

**URL:** <https://www.ruby-forum.com/t/how-can-i-use-trapping-signals-in-windows/155289>\
**Category:** Ruby\
**Created:** [December 10, 2008, 9:41am UTC](https://www.ruby-forum.com/t/how-can-i-use-trapping-signals-in-windows/155289 "2008-12-10T09:41:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jarod\_Z](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Jarod\_Z](https://www.ruby-forum.com/u/Jarod_Z)\
**Post date:** [December 10, 2008, 9:41am UTC](https://www.ruby-forum.com/t/how-can-i-use-trapping-signals-in-windows/155289/1 "2008-12-10T09:41:08Z")

</div>

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.
