diff --git a/hermes_cli/banner.py b/hermes_cli/banner.py index 291701523c..b4410592e6 100644 --- a/hermes_cli/banner.py +++ b/hermes_cli/banner.py @@ -168,10 +168,13 @@ def _git_run(args: list[str], *, cwd: Optional[Path] = None, timeout: int = 5, t encoding. ``network=True`` (ls-remote/fetch) detaches stdin and disables git/GCM prompts so a passive update check can never hang on a ``Username for 'https://github.com':`` prompt. """ - kwargs: dict = {} + from hermes_cli._subprocess_compat import noninteractive_git_env, windows_hide_flags + + # The banner/update probes run from GUI-hosted backends too (desktop-spawned + # ``hermes serve``), where a bare git child flashes a console window. + kwargs: dict = {"creationflags": windows_hide_flags()} if network: - from hermes_cli._subprocess_compat import noninteractive_git_env - kwargs = {"stdin": subprocess.DEVNULL, "env": noninteractive_git_env()} + kwargs.update({"stdin": subprocess.DEVNULL, "env": noninteractive_git_env()}) try: return subprocess.run( ["git", *args], capture_output=True, timeout=timeout, cwd=str(cwd) if cwd is not None else None, diff --git a/tests/test_windows_subprocess_no_window_flags.py b/tests/test_windows_subprocess_no_window_flags.py index f6ea2c9bde..21c563646f 100644 --- a/tests/test_windows_subprocess_no_window_flags.py +++ b/tests/test_windows_subprocess_no_window_flags.py @@ -360,8 +360,9 @@ def test_env_probe_run_hides_console_window(monkeypatch): rc, out, err = env_probe._run(["python3", "--version"], timeout=1.0) assert rc == 0 - assert len(captured) == 1, captured - cmd, kwargs = captured[0] + spawns = _spawns(captured, "python3", "--version") + assert len(spawns) == 1, captured + cmd, kwargs = spawns[0] assert cmd == ["python3", "--version"] assert kwargs["creationflags"] == _CREATE_NO_WINDOW # The temp-file capture contract (#67964) must survive: stdout/stderr are