Handle shutdown request properly if not file server is running
This commit is contained in:
parent
d927e85eca
commit
026b6a4b01
1 changed files with 11 additions and 8 deletions
|
@ -10,6 +10,7 @@ last_error = None
|
||||||
|
|
||||||
def shutdown():
|
def shutdown():
|
||||||
print "Shutting down..."
|
print "Shutting down..."
|
||||||
|
if "file_server" in dir(sys.modules["main"]) and sys.modules["main"].file_server.running:
|
||||||
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)
|
||||||
|
@ -18,6 +19,8 @@ def shutdown():
|
||||||
except Exception, err:
|
except Exception, err:
|
||||||
print "Proper shutdown error: %s" % err
|
print "Proper shutdown error: %s" % err
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
else:
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
# Store last error, ignore notify, allow manual error logging
|
# Store last error, ignore notify, allow manual error logging
|
||||||
def handleError(*args):
|
def handleError(*args):
|
||||||
|
|
Loading…
Reference in a new issue