summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkatee <hello@kate.io>2019-04-22 21:42:17 -0400
committerkatee <hello@kate.io>2019-04-22 21:42:17 -0400
commita3b7d8eb421d6e909c374c92560cfeec230bba69 (patch)
tree26d5c5c39a053883f86c086f6bb608b13c9d93d8
parent2c6adea15068ff828344c034142b74883fe6a9ae (diff)
Refactor electron to always pipe stdout to /dev/null
-rw-r--r--lib/gui/electron.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/gui/electron.py b/lib/gui/electron.py
index 8bc0bcef..6bff15aa 100644
--- a/lib/gui/electron.py
+++ b/lib/gui/electron.py
@@ -11,19 +11,22 @@ app_process = None
def open_url(url):
global app
- # Any output on stdout will crash inkscape.
- null = open(os.devnull, 'w')
+ command = []
+ cwd = None
if getattr(sys, 'frozen', None) is not None:
electron_path = os.path.join(get_bundled_dir("electron"), "inkstitch-gui")
if sys.platform == "darwin":
electron_path += ".app/Contents/MacOS/inkstitch-gui"
- subprocess.Popen(["open", "-a", electron_path, "--args", url], stdout=null)
+ command = ["open", "-a", electron_path, "--args", url]
else:
- app_process = subprocess.Popen([electron_path, url])
+ command = [electron_path, url]
else:
# if we're not running in a pyinstaller bundle, run electron directly
- app_process = subprocess.Popen(["yarn", "dev", url], cwd=get_bundled_dir("electron"), stdout=null)
+ command = ["yarn", "dev", url]
+ cwd = get_bundled_dir("electron")
- return app_process
+ # Any output on stdout will crash inkscape.
+ null = open(os.devnull, 'w')
+ return subprocess.Popen(command, cwd=cwd, stdout=null)