Skip to content

Commit a72804f

Browse files
authored
Don't open a terminal window on Windows (#64)
2 parents 600e5f3 + 0242722 commit a72804f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

openandroidinstaller/tooling.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
import sys
1717
from pathlib import Path
18+
import subprocess
1819
from subprocess import (
1920
Popen,
2021
PIPE,
@@ -38,11 +39,16 @@ def run_command(tool: str, command: List[str], bin_path: Path) -> CompletedProce
3839
raise Exception(f"Unknown tool {tool}. Use adb, fastboot or heimdall.")
3940
if PLATFORM == "win32":
4041
full_command = [str(bin_path.joinpath(Path(f"{tool}"))) + ".exe"] + command
42+
# prevent Windows from opening terminal windows
43+
si = subprocess.STARTUPINFO()
44+
si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
4145
else:
4246
full_command = [str(bin_path.joinpath(Path(f"{tool}")))] + command
47+
si = None
4348
logger.info(f"Run command: {full_command}")
49+
# run the command
4450
with Popen(
45-
full_command, stdout=PIPE, stderr=STDOUT, bufsize=1, universal_newlines=True
51+
full_command, stdout=PIPE, stderr=STDOUT, bufsize=1, universal_newlines=True, startupinfo=si
4652
) as p:
4753
for line in p.stdout:
4854
logger.info(line.strip())

0 commit comments

Comments
 (0)