From: "h.shirosaki (Hiroshi Shirosaki)" Date: 2012-03-19T23:39:14+09:00 Subject: [ruby-core:43472] [ruby-trunk - Bug #6131] Ctrl-C handler do not work from exec process (Windows) Issue #6131 has been updated by h.shirosaki (Hiroshi Shirosaki). How about removing CREATE_NEW_PROCESS_GROUP flag by default and providing a way to specify CREATE_NEW_PROCESS_GROUP flag by spawn methods's arguments? Ruby user can specify CREATE_NEW_PROCESS_GROUP flag if it's needed. spawn method has `options` parameter hash. spawn(command, options={}) -> Integer spawn(env, command, options={}) -> Integer spawn(env, program, *args, options={}) -> Integer Specify options: { :creationflags => Process::CREATE_NEW_PROCESS_GROUP } Python module does similar things. http://docs.python.org/library/subprocess.html#subprocess.CREATE_NEW_PROCESS_GROUP ---------------------------------------- Bug #6131: Ctrl-C handler do not work from exec process (Windows) https://bugs.ruby-lang.org/issues/6131#change-24944 Author: luislavena (Luis Lavena) Status: Assigned Priority: Normal Assignee: h.shirosaki (Hiroshi Shirosaki) Category: core Target version: 1.9.3 ruby -v: ruby 1.9.3-p155 (2012-03-03) [i386-mingw32] Hello, Originally reported to TheCodeShop group: https://groups.google.com/forum/?fromgroups#!topic/thecodeshop/ZI9FY-RKYgs The usage of "rails server" uses `exec` to spawn another process to run a server, and that process do not handle Ctrl-C. Script to recreate this issue: https://gist.github.com/2009356 =begin a.rb trap(:INT) do puts "Hit Ctrl+C in a.rb" end exec "ruby b.rb" =end =begin b.rb trap(:INT) do puts "Hit Ctrl+C in b.rb" exit(false) end sleep =end Invoking b directly from command line works, but from a.rb it fails to respond to Ctrl-C -- http://bugs.ruby-lang.org/