mirror of
https://github.com/bec-project/bec_widgets.git
synced 2026-11-12 04:24:07 +01:00
feat: properly handle SIGINT (ctrl-c) in BEC GUI server -> calls qapplication.quit()
This commit is contained in:
1 parent
d1266a1ce1
commit
3644f344da
2 files changed
+14
-1
No files matched your search
@@ -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())
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user