Don't use the logger from a trap context. Fixes #801.

This commit is contained in:
Ben Hollis 2013-03-03 12:31:42 -08:00
parent cda8bd759d
commit a10c8aa194

View file

@ -31,6 +31,12 @@ module Middleman
::Middleman::Profiling.report("server_start") ::Middleman::Profiling.report("server_start")
@webrick.start @webrick.start
# $mm_shutdown is set by the signal handler
if $mm_shutdown
shutdown
exit
end
end end
end end
@ -118,8 +124,9 @@ module Middleman
%w(INT HUP TERM QUIT).each do |sig| %w(INT HUP TERM QUIT).each do |sig|
if Signal.list[sig] if Signal.list[sig]
Signal.trap(sig) do Signal.trap(sig) do
shutdown # Do as little work as possible in the signal context
exit $mm_shutdown = true
@webrick.stop
end end
end end
end end