Hi All,
 
I almost got to the point where I can install any ruby program as a
Windows
service. I do this using cygwin. For example to install Instiki as a
service:

$ cygrunsrv --instal Instiki --path c:/ruby/bin/ruby.exe --args
c:/Stuff/instiki-0.9.1/instiki.rb

The executable for the service (--path) is my Win32 (not cygwin's) Ruby
executable. The argument is the name of the ruby script to run.

The service installs and start fine, but cannot be stopped (the process
has
to be manually killed). I have tried specifying various termination
signals
(using --termsig) and using a Kernel#trap to respond to them, but the
trap
is never executed, and the process doesn't stop. E.g.:
  trap("TERM") { @server.shutdown; exit(0) }

The only signal that stops the process is SIGSEGV, which isn't very nice
:P.
Besides, even traps for it don't work.

Any clues as to how to fix?
 

Cheers,
Assaph