From: "ara.t.howard" Date: 2007-12-30T02:51:56+09:00 Subject: Re: invoke INT in xp On Dec 28, 2007, at 9:34 PM, Junkone wrote: > 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/ -- share your knowledge. it's a way to achieve immortality. h.h. the 14th dalai lama