Skip to content

Commit 700dd68

Browse files
committed
add-ons: Hide subprocess console windows
Works on windows.
1 parent b90d84a commit 700dd68

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

Orange/canvas/application/addons.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -942,16 +942,6 @@ def python_process(args, script_name=None, **kwargs):
942942
# Don't run the script with a 'gui' (detached) process.
943943
dirname = os.path.dirname(executable)
944944
executable = os.path.join(dirname, "python.exe")
945-
# by default a new console window would show up when executing the
946-
# script
947-
startupinfo = subprocess.STARTUPINFO()
948-
if hasattr(subprocess, "STARTF_USESHOWWINDOW"):
949-
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
950-
else:
951-
# This flag was missing in inital releases of 2.7
952-
startupinfo.dwFlags |= subprocess._subprocess.STARTF_USESHOWWINDOW
953-
954-
kwargs["startupinfo"] = startupinfo
955945

956946
if script_name is not None:
957947
script = script_name
@@ -965,6 +955,12 @@ def python_process(args, script_name=None, **kwargs):
965955

966956

967957
def create_process(cmd, executable=None, **kwargs):
958+
if hasattr(subprocess, "STARTUPINFO"):
959+
# do not open a new console window for command on windows
960+
startupinfo = subprocess.STARTUPINFO()
961+
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
962+
kwargs["startupinfo"] = startupinfo
963+
968964
return subprocess.Popen(
969965
cmd,
970966
executable=executable,

0 commit comments

Comments
 (0)