Project

General

Profile

Feature #6236 » webrick.signal_exception.patch

Exit WEBrick on any SignalException, not just SIGINT - drbrain (Eric Hodel), 04/14/2012 07:50 AM

View differences:

lib/webrick/server.rb (working copy)
rescue Errno::EBADF, IOError => ex
# if the listening socket was closed in GenericServer#shutdown,
# IO::select raise it.
rescue Interrupt => ex # ^C
rescue SignalException => ex
@logger.fatal ex
raise
rescue Exception => ex
test/webrick/test_server.rb (working copy)
:StopCallback => Proc.new{ stopped += 1 },
}
e = assert_raises(Interrupt) do
e = assert_raises(SignalException) do
TestWEBrick.start_server(Echo, config) { |server, addr, port, log|
listener = server.listeners.first
def listener.accept
Process.kill(:INT, $$) # simulate ^C
raise SignalException, 'SIGTERM' # simulate signal in main thread
end
Thread.pass while server.status != :Running
(2-2/2)