summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2014-07-14 12:08:37 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2014-07-14 14:58:34 -0300
commitcd8f6757b51a8eedc3e29c22656ade1ae22110fe (patch)
tree27dcaa7e3268e224212361ee38af5a9e9a6241f5 /src
parent0aee7d6cbc3f2c0b764056966eeddc4057eafd08 (diff)
Apply changes removed rebasing pullreq #679.
https://github.com/leapcode/bitmask_client/pull/679/files
Diffstat (limited to 'src')
-rw-r--r--src/leap/bitmask/frontend_app.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/leap/bitmask/frontend_app.py b/src/leap/bitmask/frontend_app.py
index ffcb61ad..51607d0b 100644
--- a/src/leap/bitmask/frontend_app.py
+++ b/src/leap/bitmask/frontend_app.py
@@ -27,7 +27,6 @@ from functools import partial
from PySide import QtCore, QtGui
from leap.bitmask.config import flags
-from leap.bitmask.gui import locale_rc # noqa - silence pylint
from leap.bitmask.gui.mainwindow import MainWindow
from leap.bitmask.util import dict_to_flags
@@ -35,20 +34,24 @@ import logging
logger = logging.getLogger(__name__)
-def signal_handler(window, signum, frame):
+def signal_handler(window, pid, signum, frame):
"""
Signal handler that quits the running app cleanly.
:param window: a window with a `quit` callable
:type window: MainWindow
+ :param pid: process id of the main process.
+ :type pid: int
:param signum: number of the signal received (e.g. SIGINT -> 2)
:type signum: int
:param frame: current stack frame
:type frame: frame or None
"""
- pname = multiprocessing.current_process().name
- logger.debug("{0}: SIGNAL #{1} catched.".format(pname, signum))
- window.quit()
+ my_pid = os.getpid()
+ if pid == my_pid:
+ pname = multiprocessing.current_process().name
+ logger.debug("{0}: SIGNAL #{1} catched.".format(pname, signum))
+ window.quit()
def run_frontend(options, flags_dict):
@@ -101,7 +104,8 @@ def run_frontend(options, flags_dict):
window = MainWindow(start_hidden=start_hidden)
- sig_handler = partial(signal_handler, window)
+ my_pid = os.getpid()
+ sig_handler = partial(signal_handler, window, my_pid)
signal.signal(signal.SIGINT, sig_handler)
signal.signal(signal.SIGTERM, sig_handler)