From a2cafbb1afd44d7b255900a5912294de7e6e3fda Mon Sep 17 00:00:00 2001 From: Nils <> Date: Sun, 5 Jul 2020 20:41:36 +0200 Subject: [PATCH] Capture SIGINT Ctrl+C for a clean server exit through atexit --- engine/start.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/engine/start.py b/engine/start.py index d2dffea..0ec1e20 100644 --- a/engine/start.py +++ b/engine/start.py @@ -229,6 +229,13 @@ except: pass +#Capture Ctlr+C / SIGINT and let @atexit handle the rest. +import signal +import sys +def signal_handler(sig, frame): + sys.exit(0) #atexit will trigger +signal.signal(signal.SIGINT, signal_handler) + #Catch Exceptions even if PyQt crashes. import sys sys._excepthook = sys.excepthook