From 6da6958335f94e62c2e70ebc2c8b57297911a18f Mon Sep 17 00:00:00 2001 From: astaric Date: Mon, 25 Sep 2017 17:01:19 +0200 Subject: [PATCH] add-ons: Hide subprocess console windows Works on windows. --- Orange/canvas/application/addons.py | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Orange/canvas/application/addons.py b/Orange/canvas/application/addons.py index 24db91ed7ae..52b6a19a90c 100644 --- a/Orange/canvas/application/addons.py +++ b/Orange/canvas/application/addons.py @@ -942,16 +942,6 @@ def python_process(args, script_name=None, **kwargs): # Don't run the script with a 'gui' (detached) process. dirname = os.path.dirname(executable) executable = os.path.join(dirname, "python.exe") - # by default a new console window would show up when executing the - # script - startupinfo = subprocess.STARTUPINFO() - if hasattr(subprocess, "STARTF_USESHOWWINDOW"): - startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW - else: - # This flag was missing in inital releases of 2.7 - startupinfo.dwFlags |= subprocess._subprocess.STARTF_USESHOWWINDOW - - kwargs["startupinfo"] = startupinfo if script_name is not None: script = script_name @@ -965,6 +955,12 @@ def python_process(args, script_name=None, **kwargs): def create_process(cmd, executable=None, **kwargs): + if hasattr(subprocess, "STARTUPINFO"): + # do not open a new console window for command on windows + startupinfo = subprocess.STARTUPINFO() + startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW + kwargs["startupinfo"] = startupinfo + return subprocess.Popen( cmd, executable=executable,