Print message before shutdown

This commit is contained in:
shortcutme 2016-11-07 23:10:31 +01:00
parent d5d3f32bf8
commit b7ede15b06

View file

@ -9,6 +9,7 @@ from Config import config
last_error = None last_error = None
def shutdown(): def shutdown():
print "Shutting down..."
try: try:
if "file_server" in dir(sys.modules["main"]): if "file_server" in dir(sys.modules["main"]):
gevent.spawn(sys.modules["main"].file_server.stop) gevent.spawn(sys.modules["main"].file_server.stop)
@ -30,6 +31,7 @@ def handleError(*args):
last_error = args last_error = args
if args[0].__name__ == "KeyboardInterrupt": if args[0].__name__ == "KeyboardInterrupt":
shutdown() shutdown()
return
if not silent and args[0].__name__ != "Notify": if not silent and args[0].__name__ != "Notify":
logging.exception("Unhandled exception") logging.exception("Unhandled exception")
sys.__excepthook__(*args) sys.__excepthook__(*args)