invoke INT in xp

J

Junkone

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>
 
A

ara.t.howard

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>



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

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/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,241
Latest member
Lisa1997

Latest Threads

Top