fix: use pythonw.exe for Windows gateway post-update restart - #49025
fix: use pythonw.exe for Windows gateway post-update restart#49025APEMH-IT wants to merge 1 commit into
Conversation
_root_cause: _gateway_run_args_for_profile() used get_python_path() which returns venv/Scripts/python.exe (console subsystem) on Windows. After hermes update, the gateway restart watcher spawned python.exe instead of pythonw.exe, leaving a visible console window on the user's desktop. fix: on Windows, resolve the sibling pythonw.exe (windowless GUI subsystem) from the python.exe path returned by get_python_path(). This mirrors the approach used by Hermes_Gateway.cmd (gateway_windows._build_gateway_cmd_script) which already derives pythonw.exe via _derive_venv_pythonw() for detached service-managed launches. Closes the post-update window-left-open issue reported by the Windows user.
|
Duplicate of #44288 — same fix in the same function ( |
|
Note: This is NOT a duplicate of the prior closed PRs (#44288, #44288). The earlier PRs were closed because they were stale (far behind upstream main). This version has been cherry-picked onto the latest origin/main with a clean diff containing only the fix changes. No conflicts. CI green. Ready for review. |
|
Thanks for the focused Windows repro and fix. Automated hermes-sweeper review found that current
The earlier duplicate discussion correctly identified the same restart path; main now contains the complete version, so this PR is superseded. |
Summary
On Windows, after running
hermes update, a black console window (python.exe) stays open on the desktop. The gateway works fine, but the window is visual noise and closing it kills the gateway.Root cause
_gateway_run_args_for_profile()usedget_python_path()which returnsvenv/Scripts/python.exe(console subsystem). The post-update gateway restart watcher spawnedpython.exeinstead ofpythonw.exe(windowless GUI subsystem).Fix
On Windows, resolve the sibling
pythonw.exefrom thepython.exepath returned byget_python_path(). This mirrors whatHermes_Gateway.cmd(generated bygateway_windows._build_gateway_cmd_script()) already does via_derive_venv_pythonw().Notes
_gateway_run_args_for_profile()was changed (5 lines added).is_windows()— no impact on POSIX platforms.python.exeifpythonw.exedoesn't exist (defensive).Testing
Tested locally on Windows 10 (git-bash). Before: console window visible after
hermes update. After: no window — gateway runs cleanly in the background via pythonw.exe.