mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Create universal exit function so exiting code can be in one place.
This commit is contained in:
parent
736924c839
commit
23ce45724a
@ -49,6 +49,9 @@ class MainPrompt(cmd.Cmd, object):
|
||||
console.critical("Unable to write exit file due to error: {}".format(e))
|
||||
|
||||
def do_exit(self, line):
|
||||
self.universal_exit()
|
||||
|
||||
def universal_exit(self):
|
||||
logger.info("Stopping all server daemons / threads")
|
||||
console.info("Stopping all server daemons / threads - This may take a few seconds")
|
||||
websocket_helper.disconnect_all()
|
||||
|
8
main.py
8
main.py
@ -141,10 +141,4 @@ if __name__ == '__main__':
|
||||
logger.info("Recieved SIGINT, stopping Crafty")
|
||||
break
|
||||
|
||||
logger.info("Stopping all server daemons / threads")
|
||||
console.info("Stopping all server daemons / threads - This may take a few seconds")
|
||||
Crafty._clean_shutdown()
|
||||
while True:
|
||||
if tasks_manager.get_main_thread_run_status():
|
||||
sys.exit(0)
|
||||
time.sleep(1)
|
||||
Crafty.universal_exit()
|
||||
|
Loading…
Reference in New Issue
Block a user