Skip to content

Commit

Permalink
allow exiting application using ctrl + c (signal sigint)
Browse files Browse the repository at this point in the history
for easier debugging
  • Loading branch information
adrelanos committed Aug 30, 2023
1 parent 026dcb2 commit 563ac03
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
3 changes: 0 additions & 3 deletions usr/bin/setup-wizard-dist
Expand Up @@ -5,7 +5,4 @@
## See the file COPYING for copying conditions.

from setup_wizard_dist import setup_wizard_dist
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)

setup_wizard_dist.main()
Expand Up @@ -13,6 +13,7 @@
import os, yaml
import inspect
import sys
import signal
import pathlib

from guimessages.translations import _translations
Expand All @@ -21,6 +22,11 @@
import shutil


def sigint_handler(*args):
"""Handler for the SIGINT signal."""
QtWidgets.QApplication.quit()


def power_off_system():
print('WARNING: legal not accepted. Shutdown initiated.')
if os.path.exists('/etc/dev'):
Expand Down Expand Up @@ -312,6 +318,14 @@ def main():

app = QtWidgets.QApplication(sys.argv)

# Bind the CTRL+C signal
signal.signal(signal.SIGINT, sigint_handler)

# Ensure the application will be responsive to the SIGINT signal (CTRL+C)
timer = QTimer()
timer.timeout.connect(lambda: None)
timer.start(500)

# when there is no page need showing, we simply do not start GUI to
# avoid an empty page
if len(Common.wizard_steps) == 0:
Expand Down

0 comments on commit 563ac03

Please sign in to comment.