From: Arne Juul Date: 2008-02-22T17:08:55+09:00 Subject: Re: SIGTERM signal is ignored by a process run using Ruby Luca Boero wrote: > I am using Ruby 1.8.5 in a Rails 1.2.5 environment. > My code starts a dhcp-3.1.0 service taken from > http://www.isc.org/products/DHCP > Once started the dhcpd process cannot be stopped using the normal > "/etc/init.d/dhcp stop" > as it seems not to catch SIGTERM (signal 15) used within the service > script. here's a late confirmation: this is definitely a bug in ruby 1.8.5, which looks like it's fixed in 1.8.6. here's a small test program to verify if you have the bug: previous_handler = trap('TERM') { raise RuntimeError, "signal" } puts "prev handler:" puts previous_handler myhandler = trap('TERM', previous_handler) puts "temp handler:" puts myhandler nhandler = trap('TERM', previous_handler) puts "handler after restore:" puts nhandler puts `echo test self-kill; kill $$; echo should not get here, that is a bug` trap('TERM', "DEFAULT") defhandler = trap('TERM', "DEFAULT") puts "handler should be default, is:" puts defhandler correct output would look like this: prev handler: DEFAULT temp handler: # handler after restore: DEFAULT test self-kill handler should be default, is: DEFAULT but when I test it on 1.8.5 I get this instead: prev handler: nil temp handler: # handler after restore: IGNORE test self-kill should not get here, that is a bug handler should be default, is: nil - Arne H. J. -- Posted via http://www.ruby-forum.com/.