feat: properly handle SIGINT (ctrl-c) in BEC GUI server -> calls qapplication.quit()

This commit is contained in:
guijar_m authored and wyzula_j committed 2024-06-21 12:32:59 +02:00
1 parent d1266a1ce1
commit 3644f344da
2 files changed
+14 -1

No files matched your search

+8
View File
@@ -1,4 +1,5 @@
import inspect
import signal
import sys
from contextlib import redirect_stderr, redirect_stdout
from typing import Union
@@ -200,6 +201,13 @@ def main():
app.aboutToQuit.connect(server.shutdown)
def sigint_handler(*args):
# display message, for people to let it terminate gracefully
print("Caught SIGINT, exiting")
app.quit()
signal.signal(signal.SIGINT, sigint_handler)
sys.exit(app.exec())