Cleaner exit on exception

This commit is contained in:
Denis Knauf 2010-03-29 19:19:11 +02:00
parent cf83e98162
commit 584c0014ed

View file

@ -54,6 +54,7 @@ module LogAn::Inc
rescue Object rescue Object
# It's better to close everything, because BDB doesn't like unexpected exits # It's better to close everything, because BDB doesn't like unexpected exits
self.at_exit self.at_exit
raise $!
end end
# Will be called at exit. Will close all opened BDB::Env # Will be called at exit. Will close all opened BDB::Env
@ -62,7 +63,7 @@ module LogAn::Inc
@etc and @etc.close @etc and @etc.close
end end
# Shutdown Server cleanly. # Shutdown Server cleanly. First shutdown TCPServer.
def shutdown signal = nil def shutdown signal = nil
$stderr.puts [:signal, signal, Signal[signal]].inspect if signal $stderr.puts [:signal, signal, Signal[signal]].inspect if signal
@serv.close @serv.close