diff --git a/app/classes/shared/cmd.py b/app/classes/shared/cmd.py index e8c1570f..fef1b426 100644 --- a/app/classes/shared/cmd.py +++ b/app/classes/shared/cmd.py @@ -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() diff --git a/main.py b/main.py index 52821a17..71fd2489 100644 --- a/main.py +++ b/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()