From a838ef76217b2cfea8f7585607b28c65257ab709 Mon Sep 17 00:00:00 2001 From: Matthew Stratford Date: Sat, 19 Mar 2022 16:01:37 +0000 Subject: [PATCH] Fix exit hang on linux --- launch.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/launch.py b/launch.py index 712bb6a..eed32ec 100755 --- a/launch.py +++ b/launch.py @@ -2,6 +2,7 @@ import multiprocessing import time import sys +import os from typing import Any import webbrowser from setproctitle import setproctitle @@ -31,11 +32,14 @@ def startServer(notifications=False): printer("Server dead. Exiting.") if notifications: notif("BAPSicle Server Stopped!") - sys.exit(0) + os._exit(0) if server and server.is_alive(): + printer("Terminating server.") server.terminate() + printer("Waiting to terminate.") server.join(timeout=20) # If we somehow get stuck stopping BAPSicle let it die. + printer("Terminated") # Catch the handler being killed externally. except Exception as e: @@ -80,9 +84,10 @@ if __name__ == "__main__": type(e).__name__, e ) ) - sys.exit(1) + os._exit(1) - sys.exit(0) + os._exit(0) else: startServer() - sys.exit(0) + printer("Exiting.") + os._exit(0)