Evita finestres de consola a Windows als subprocessos (CREATE_NO_WINDOW)
This commit is contained in:
@@ -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}")
|
||||
|
||||
@@ -4,6 +4,7 @@ from __future__ import annotations
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from collections.abc import Callable
|
||||
from pathlib import Path
|
||||
|
||||
@@ -12,6 +13,11 @@ from .paths import repo_dir
|
||||
|
||||
LogFn = Callable[[str], None]
|
||||
|
||||
# Windows: evita que la compilación/ejecución (shell + make/gcc, apps de consola)
|
||||
# abra ventanas negras cuando el lanzador corre como GUI sin consola (el .exe).
|
||||
# En el resto de SO es 0 (sin efecto).
|
||||
_NO_WINDOW = subprocess.CREATE_NO_WINDOW if sys.platform == "win32" else 0
|
||||
|
||||
# Directorios habituales de herramientas de línea de comandos (Homebrew, MacPorts…).
|
||||
# Una .app de macOS lanzada desde Finder/Dock NO hereda el PATH del shell de login,
|
||||
# así que herramientas como cmake, instaladas con Homebrew en /opt/homebrew/bin
|
||||
@@ -90,6 +96,7 @@ def _stream(cmd: str, cwd: Path, log: LogFn) -> int:
|
||||
text=True,
|
||||
bufsize=1,
|
||||
env=_launch_env(),
|
||||
creationflags=_NO_WINDOW,
|
||||
)
|
||||
assert proc.stdout is not None
|
||||
for line in proc.stdout:
|
||||
|
||||
Reference in New Issue
Block a user