win32utils-devel@rubyforge.org
2004-Nov-20 22:52 UTC
[Win32utils-devel] SIGINT in win32-process
Hi all,
I banged my head all day trying to make SIGINT work like you would expect on
Win32, to no avail. The goal is to allow the user to send a SIGINT (i.e.
CTRL_C_EVENT) to a remote process. I tried a CreateRemoteThread() +
GenerateConsoleCtrlEvent() approach with no luck. I also found this bit of
code:
http://www.mit.edu/afs/athena.mit.edu/contrib/xemacs/src/xemacs-21.4.4/src/process-nt.c
But, I can''t seem to make it, or my own attempts, work. For further
clarification, here is what I''m trying to accomplish. Start this
program on
one console:
# test.rb
trap("SIGINT"){
puts "Got signal"
exit
}
puts "PID: " + Process.pid.to_s
while 1
puts "Hello"
sleep 3
end
Then, from another console, try to send Process.kill(2,pid) using
win32-process. You will need to modify process_kill() in process.c slightly
to make sure case 2 is the ctrl_c handler.
Is what I''m trying to do even possible? Help wanted.
Regards,
Dan
In the immortal words of Socrates, "I drank what?"
