diff options
author | Ivan Alejandro <ivanalejandro0@gmail.com> | 2014-06-25 12:36:25 -0300 |
---|---|---|
committer | Ivan Alejandro <ivanalejandro0@gmail.com> | 2014-07-14 12:14:20 -0300 |
commit | c46a93e290194cdeb1b4e1776d4bf0edde303072 (patch) | |
tree | d4e3b043228fe27da8d6bcb3e1924d5b76ac6d9b /src/leap | |
parent | d35f12b00629d6578039a11ce5e18d0c58e3fa73 (diff) |
Add SIGINT handler.
Diffstat (limited to 'src/leap')
-rw-r--r-- | src/leap/bitmask/app.py | 4 | ||||
-rw-r--r-- | src/leap/bitmask/frontend_app.py | 22 |
2 files changed, 9 insertions, 17 deletions
diff --git a/src/leap/bitmask/app.py b/src/leap/bitmask/app.py index 9afe41be..eda4073c 100644 --- a/src/leap/bitmask/app.py +++ b/src/leap/bitmask/app.py @@ -41,6 +41,7 @@ # (thanks to: http://www.glassgiant.com/ascii/) import multiprocessing import os +import signal import sys from leap.bitmask.backend.utils import generate_certificates @@ -112,6 +113,9 @@ def start_app(): """ Starts the main event loop and launches the main window. """ + # Ensure that the application quits using CTRL-C + signal.signal(signal.SIGINT, signal.SIG_DFL) + # Parse arguments and store them opts = leap_argparse.get_options() do_display_version(opts) diff --git a/src/leap/bitmask/frontend_app.py b/src/leap/bitmask/frontend_app.py index 12703518..60f20e3c 100644 --- a/src/leap/bitmask/frontend_app.py +++ b/src/leap/bitmask/frontend_app.py @@ -18,8 +18,6 @@ import signal import sys import os -from functools import partial - from PySide import QtCore, QtGui from leap.bitmask.config import flags @@ -41,18 +39,6 @@ def sigint_handler(*args, **kwargs): mainwindow.quit() -def sigterm_handler(*args, **kwargs): - """ - Signal handler for SIGTERM. - This handler is actually passed to twisted reactor - """ - logger = kwargs.get('logger', None) - if logger: - logger.debug("SIGTERM catched. shutting down...") - mainwindow = args[0] - mainwindow.quit() - - def run_frontend(options): """ Run the GUI for the application. @@ -88,10 +74,12 @@ def run_frontend(options): qApp.setApplicationName("leap") qApp.setOrganizationDomain("leap.se") - window = MainWindow(start_hidden=start_hidden) + MainWindow(start_hidden=start_hidden) - sigint_window = partial(sigint_handler, window, logger=logger) - signal.signal(signal.SIGINT, sigint_window) + # sigint_window = partial(sigint_handler, window, logger=logger) + # signal.signal(signal.SIGINT, sigint_window) + # Ensure that the application quits using CTRL-C + signal.signal(signal.SIGINT, signal.SIG_DFL) sys.exit(qApp.exec_()) |