From: Stanislav Senotrusov Date: 2011-06-28T13:47:01+09:00 Subject: [ruby-core:37609] [Ruby 1.9 - Bug #4939] Signal handling does not working if single grave accent ( ` ) initiated command was issued before Signal.trap Issue #4939 has been updated by Stanislav Senotrusov. The problem disappears after upgrade to Linux foo 2.6.39-0-generic #5~20110427-Ubuntu SMP Wed Apr 27 17:41:08 UTC 2011 i686 i686 i386 GNU/Linux using kernel-ppa. I've suggest it's not a Ruby bug. Thank you. ---------------------------------------- Bug #4939: Signal handling does not working if single grave accent ( ` ) initiated command was issued before Signal.trap http://redmine.ruby-lang.org/issues/4939 Author: Stanislav Senotrusov Status: Feedback Priority: Normal Assignee: Hiroshi Nakamura Category: core Target version: ruby -v: ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux] If grave accent ( ` ) shell command (`whoami` in the following case) is called BEFORE Signal.trap, the signals will not be handled, and ruby default handling behavior also did not work. Basically, when I press Ctrl+C or send kill -TERM nothing happens - the process continues to run (or sleep(60) in that case). # This `whoami` call prevents the following signal handlers from working # Just comment this line and signal handling will be ok STDOUT.write `whoami` STDOUT.puts "Press Ctrl+C" Signal.trap(:INT) { STDOUT.write "GOT INT\n"; exit! } Signal.trap(:TERM) { STDOUT.write "GOT TERM\n"; exit! } sleep 60 -- http://redmine.ruby-lang.org