diff options
author | kali <kali@leap.se> | 2017-08-07 13:47:34 -0700 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2017-08-14 18:10:06 -0400 |
commit | 523ec97cafcaff3090edbe18a1edcb4e615370a0 (patch) | |
tree | 74559061b2a9cf67f8b49d82611cf3533e002bae | |
parent | 25cf226869cbd3b36f8d1de49b7c94c2c2a81a84 (diff) |
[bug] kill a previous process in osx
Since in OSX the user sees Bitmask in the Dock, I assume that re-launching
Bitmask.app from the /Applications folder means that we can kill the previous
process.
It probably should be able to terminate it gracefully, but we're hitting this
during early testing because of the move to native webview - because the
window.close() method is still not properly hooked.
- Resolves: #9001
-rw-r--r-- | src/leap/bitmask/gui/app2.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/leap/bitmask/gui/app2.py b/src/leap/bitmask/gui/app2.py index 13f369c..f037a00 100644 --- a/src/leap/bitmask/gui/app2.py +++ b/src/leap/bitmask/gui/app2.py @@ -31,17 +31,21 @@ import webbrowser from functools import partial from multiprocessing import Process +import webview +import psutil + from leap.bitmask.core.launcher import run_bitmaskd, pid from leap.common.config import get_path_prefix #from leap.bitmask.gui import app_rc -import webview DEBUG = os.environ.get("DEBUG", False) BITMASK_URI = 'http://localhost:7070/' PIXELATED_URI = 'http://localhost:9090/' +PROCNAME = 'bitmask-app' + qApp = None bitmaskd = None browser = None @@ -114,7 +118,13 @@ def launch_gui(): def start_app(): from leap.bitmask.util import STANDALONE - os.environ['QT_AUTO_SCREEN_SCALE_FACTOR'] = '1' + + mypid = os.getpid() + + # Kill a previously-running process + for proc in psutil.process_iter(): + if proc.name() == PROCNAME and proc.pid != mypid: + proc.kill() # Allow the frozen binary in the bundle double as the cli entrypoint # Why have only a user interface when you can have two? |