mirror of
https://github.com/HelloZeroNet/ZeroNet.git
synced 2023-12-14 04:33:03 +01:00
Print message before shutdown
This commit is contained in:
parent
d5d3f32bf8
commit
b7ede15b06
1 changed files with 3 additions and 1 deletions
|
@ -9,6 +9,7 @@ from Config import config
|
|||
last_error = None
|
||||
|
||||
def shutdown():
|
||||
print "Shutting down..."
|
||||
try:
|
||||
if "file_server" in dir(sys.modules["main"]):
|
||||
gevent.spawn(sys.modules["main"].file_server.stop)
|
||||
|
@ -30,6 +31,7 @@ def handleError(*args):
|
|||
last_error = args
|
||||
if args[0].__name__ == "KeyboardInterrupt":
|
||||
shutdown()
|
||||
return
|
||||
if not silent and args[0].__name__ != "Notify":
|
||||
logging.exception("Unhandled exception")
|
||||
sys.__excepthook__(*args)
|
||||
|
@ -91,4 +93,4 @@ if __name__ == "__main__":
|
|||
thread1.kill(exception=Debug.Notify("Worker stopped"))
|
||||
#thread2.throw(Debug.Notify("Throw"))
|
||||
print "killed"
|
||||
gevent.joinall([thread1,thread2])
|
||||
gevent.joinall([thread1,thread2])
|
Loading…
Reference in a new issue