Evita finestres de consola a Windows als subprocessos (CREATE_NO_WINDOW)

This commit is contained in:
Sergio Valor Martinez
2026-06-01 12:58:59 +02:00
parent 1e530a413d
commit e60c3cc6eb
2 changed files with 14 additions and 0 deletions
+7
View File
@@ -46,6 +46,11 @@ class NetConfig:
DEFAULT_NET = NetConfig()
# Windows: evita que cada `git` (aplicación de consola) abra una ventana negra
# cuando el lanzador corre como GUI sin consola (el .exe compilado con Nuitka
# --windows-console-mode=disable). En el resto de SO es 0 (sin efecto).
_NO_WINDOW = subprocess.CREATE_NO_WINDOW if sys.platform == "win32" else 0
def _noop(_: str) -> None:
pass
@@ -126,6 +131,7 @@ def _run_git(
text=True,
env={**os.environ, "GIT_TERMINAL_PROMPT": "0"},
timeout=timeout,
creationflags=_NO_WINDOW,
)
except subprocess.TimeoutExpired:
emit(
@@ -299,6 +305,7 @@ def _read_version(game: Game, repo: Path, log: LogFn) -> str:
capture_output=True,
text=True,
timeout=20,
creationflags=_NO_WINDOW,
)
except (OSError, subprocess.SubprocessError) as exc:
log(f"version_cmd ha fallat: {exc}")