# Invoke INT in xp

**URL:** <https://www.ruby-forum.com/t/invoke-int-in-xp/124494>\
**Category:** Ruby\
**Created:** [December 29, 2007, 5:35am UTC](https://www.ruby-forum.com/t/invoke-int-in-xp/124494 "2007-12-29T05:35:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [December 29, 2007, 5:35am UTC](https://www.ruby-forum.com/t/invoke-int-in-xp/124494/1 "2007-12-29T05:35:51Z")

</div>

Hello  
How do i invoke the INT signal in xp using ruby. i have this following  
code running to do something when its process has a INT signal.  
however i dont know how to invoke it.  
trap(“INT”) {  
begin  
bot.deliver(bot.master,“this is a test run”)  
rescue Exception =\> e  
puts e  
end

I tried, Kill but it does not recognise the pid i sentwhich is valid  
irb(main):001:0\> Process.kill(“INT”,4744)  
Errno::EINVAL: Invalid argument  
from (irb):1:in `kill' from (irb):1 irb(main):002:0> Process.kill("INT") ArgumentError: wrong number of arguments -- kill(sig, pid...) from (irb):2:in`kill’  
from (irb):2  
irb(main):003:0\> Process.kill(“INT”,4744)  
Errno::EINVAL: Invalid argument  
from (irb):3:in `kill’  
from (irb):3  
irb(main):004:0\>

---

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [December 29, 2007, 6:52pm UTC](https://www.ruby-forum.com/t/invoke-int-in-xp/124494/2 "2007-12-29T18:52:54Z")

</div>

On Dec 28, 2007, at 9:34 PM, Junkone wrote:

> Errno::EINVAL: Invalid argument  
> from (irb):3:in `kill’  
> from (irb):3  
> irb(main):004:0\>

afaikt you cannot send a signal to another process in windows using  
ruby. the win32-process module has an alternate impl that does allow  
this - but then trap does not work ;-(

see this post for a very very simple work around that’s also cross  
platform:

[http://drawohara.com/post/22540307](http://drawohara.com/post/22540307)

the basic concept is that you use drb to cause a process to signal  
itself - which _does_ work on windows, including the trap of said  
signal.

regards.

a @ [http://codeforpeople.com/](http://codeforpeople.com/)
