From: Ara.T.Howard [mailto:Ara.T.Howard@noaa.gov]
Sent: Wednesday, September 21, 2005 9:00 AM
To: ruby-talk ML
Subject: Re: signals and win32
<snip>
basically i'm doing this in one irb session
irb > Process::pid
1234
irb > trap(2){ STDERR.puts "got 2"}
and then, in another command window
irb > require 'win32/process'
irb > Process::kill 2, 1234
but this doesn't work. of course i've tried with scripts too
in order to make sure irb didn't have some signal handlers of
it's own. i always end up getting errors from the kill or,
if the kill works, the trap does not: the other process
simply exits no matter what - eg. trap doesn't seem to work.
hope that is enough info - i'm away from that machine right now.
cheers.
-a
Oh, right, now I remember. The problem is that signals 2 and 3 will
only be caught on processes created, via CreateProcess(), with the
CREATE_NEW_PROCESS_GROUP flag. This is, unfortunately, just the way
that GenerateConsoleCtrlEvent() works.
/base/generateconsolectrlevent.asp
So, I'm guessing that in most cases, it's not very useful.
Regards,
Dan
···
-----Original Message-----
hmm. no way to specifcally allow unrelated process to signal you then eh?
oh well - i re-implemented acgi to use no locking or pipes and signals
instead. big suprise - it was __slower__. so i'm back to pipes. what's your
feeling on pipes in win32 - do they have the same blocking semantics as in
unix?
cheers.
-a
···
On Thu, 22 Sep 2005, Berger, Daniel wrote:
basically i'm doing this in one irb session
irb > Process::pid
1234
irb > trap(2){ STDERR.puts "got 2"}
and then, in another command window
irb > require 'win32/process'
irb > Process::kill 2, 1234
but this doesn't work. of course i've tried with scripts too
in order to make sure irb didn't have some signal handlers of
it's own. i always end up getting errors from the kill or,
if the kill works, the trap does not: the other process
simply exits no matter what - eg. trap doesn't seem to work.
hope that is enough info - i'm away from that machine right now.
cheers.
-a
Oh, right, now I remember. The problem is that signals 2 and 3 will
only be caught on processes created, via CreateProcess(), with the
CREATE_NEW_PROCESS_GROUP flag. This is, unfortunately, just the way
that GenerateConsoleCtrlEvent() works.
Technical documentation | Microsoft Learn
/base/generateconsolectrlevent.asp
So, I'm guessing that in most cases, it's not very useful.
--
email :: ara [dot] t [dot] howard [at] noaa [dot] gov
phone :: 303.497.6469
Your life dwells amoung the causes of death
Like a lamp standing in a strong breeze. --Nagarjuna
===============================================================================