Skip to content

Hide Windows console windows for headed-launch supervisors - #6

Open
bartholomewtj wants to merge 1 commit into
captivus:mainfrom
bartholomewtj:hide-windows-supervisor-console
Open

Hide Windows console windows for headed-launch supervisors#6
bartholomewtj wants to merge 1 commit into
captivus:mainfrom
bartholomewtj:hide-windows-supervisor-console

Conversation

@bartholomewtj

Copy link
Copy Markdown

On Windows, a headed chrome-agent launch leaves a visible cmd window for the life of the browser (and sometimes after). That window is the per-instance supervisor (python.exe -m chrome_agent.supervisor).

DETACHED_PROCESS is the wrong flag for this: for console apps it allocates a new console, and it also makes CREATE_NO_WINDOW a no-op.

This PR:

  • Spawns the supervisor with pythonw.exe when it sits next to the interpreter
  • Passes CREATE_NO_WINDOW | CREATE_NEW_PROCESS_GROUP (and SW_HIDE) instead of DETACHED_PROCESS
  • Uses the same kwargs when launching Chrome itself, so any console child is hidden the same way
  • Adds unit tests for the flag contract and for spawn_supervisor wiring

Verified on Windows 11: headed launch has no supervisor console; stop reaps the pythonw process.

Once this is on PyPI, uv tool upgrade chrome-agent keeps the fix instead of wiping a local patch.

DETACHED_PROCESS gives python.exe a new visible cmd window and makes
CREATE_NO_WINDOW a no-op. Spawn the supervisor with pythonw.exe and
CREATE_NO_WINDOW so the helper outlives launch without a leftover console.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant