Hide transient command windows

This commit is contained in:
王鹏
2026-10-09 16:11:08 +08:00
parent 11cec27774
commit 6c79ce0b26
4 changed files with 24 additions and 1 deletions

View File

@@ -214,7 +214,17 @@ def _run_command(
executable = Path(command[0])
if executable.name.lower() in {"catalina.bat", "catalina.sh"} and executable.exists():
environment["CATALINA_HOME"] = str(executable.parent.parent)
return subprocess.run(command, capture_output=True, text=True, timeout=6, shell=False, env=environment)
creation_flags = getattr(subprocess, "CREATE_NO_WINDOW", 0) if os.name == "nt" else 0
return subprocess.run(
command,
capture_output=True,
text=True,
errors="replace",
timeout=6,
shell=False,
env=environment,
creationflags=creation_flags,
)
def _combine_output(completed: subprocess.CompletedProcess[str]) -> str: