Make sure server definitely quits with timeout.

This commit is contained in:
Matthew Stratford 2021-09-24 20:26:48 +01:00
parent 076440d7c8
commit c82b19309a

View file

@ -35,7 +35,7 @@ def startServer(notifications=False):
if server and server.is_alive(): if server and server.is_alive():
server.terminate() server.terminate()
server.join() server.join(timeout=20) # If we somehow get stuck stopping BAPSicle let it die.
# Catch the handler being killed externally. # Catch the handler being killed externally.
except Exception as e: except Exception as e:
@ -43,7 +43,7 @@ def startServer(notifications=False):
type(e).__name__, e.args)) type(e).__name__, e.args))
if server and server.is_alive(): if server and server.is_alive():
server.terminate() server.terminate()
server.join() server.join(timeout=20)
def printer(msg: Any): def printer(msg: Any):
@ -81,3 +81,4 @@ if __name__ == "__main__":
sys.exit(0) sys.exit(0)
else: else:
startServer() startServer()
sys.exit(0)