From fb2a0b42a554591a4721cf14ffc56e3525a33ee1 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 26 Feb 2009 15:07:27 -0500 Subject: [PATCH] Made Mongrel honor CTRL-C shutdown under Windows --- .../vendor/rack-1.0/rack/handler/mongrel.rb | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/mongrel.rb b/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/mongrel.rb index 178a1a8..fb75773 100644 --- a/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/mongrel.rb +++ b/actionpack/lib/action_controller/vendor/rack-1.0/rack/handler/mongrel.rb @@ -29,6 +29,11 @@ module Rack server.register('/', Rack::Handler::Mongrel.new(app)) end yield server if block_given? + trap("INT") { server.stop } + # ensure a dummy thread that will allow the INTERRUPT to be processed + # otherwise, the HttpHandler will only process the INTERRUPT whenever + # a socket connection is accepted. + $mongrel_sleeper_thread = Thread.new { loop { sleep 1 } } server.run.join end -- 1.6.1.9.g97c34