Skip to content

fix(win): hide the console window for background child processes - #116

Open
Aikiooo wants to merge 1 commit into
shellular-org:mainfrom
Aikiooo:fix/windows-hide-agent-console
Open

fix(win): hide the console window for background child processes#116
Aikiooo wants to merge 1 commit into
shellular-org:mainfrom
Aikiooo:fix/windows-hide-agent-console

Conversation

@Aikiooo

@Aikiooo Aikiooo commented Sep 10, 2026

Copy link
Copy Markdown

What

On Windows, Node allocates a console window for a child process unless windowsHide is set. That window flashes on screen and can take focus away from whatever the user is doing. For the agent processes, which live for the whole session, it happens on every start.

process-scanner.ts already passes the option. The other background call sites did not, so this sets it on the ones whose output is captured:

File Command
agents/base.ts the ACP agent subprocess
agents/codex-readonly.ts app-server --stdio
filesystem/index.ts git show HEAD:<path> for diffs
notify.ts the desktop notification helper
ports.ts netstat, findstr, taskkill (the win32 branches)
update-and-start.ts npm list -g shellular
update-runner.ts the detached self-update worker
utils.ts where in commandExists

Left alone on purpose

  • stdio: "inherit" spawns in daemon.ts and update-and-start.ts. pm2 startup prints the sudo command the user has to read and re-run, so those windows must stay visible. Hiding them would hide output the user needs.
  • POSIX-only branches ÔÇö lsof, /bin/sh, and the login shell used for command -v ÔÇö plus macOS caffeinate. The option does nothing there, so adding it would be noise.
  • terminal/index.ts spawns through node-pty, which exposes no option for this on Windows. Worth knowing: node-pty's own kill() forks a helper to enumerate the console process list without windowsHide, so closing a terminal can flash a window regardless of this change. That one belongs upstream in microsoft/node-pty, not here.

Risk

None off Windows: windowsHide maps to CREATE_NO_WINDOW and Node ignores it on other platforms. Every site changed here has its output captured, so nothing that a caller reads goes away.

Tests

The cli package has no test setup, and this is a spawn-option change, so I did not add a test rather than introduce a framework here. tsc and biome check are clean.

Note

I cannot verify the window behaviour itself from this machine beyond the reasoning above; the option's semantics are documented, but I did not observe a console window with and without it.

On Windows, Node allocates a console window for a child process unless
`windowsHide` is set. The window flashes on screen and can take focus away
from whatever the user is doing — for the agent processes, which live for
the whole session, on every start.

`process-scanner.ts` already passed the option; the other background call
sites did not. Set it on the ones whose output is captured, so the flag is
consistent across the CLI.

Left alone on purpose:

- `daemon.ts` and `update-and-start.ts` when spawning with `stdio:
  "inherit"` — `pm2 startup` prints the `sudo` command the user has to
  read and re-run, so those windows must stay visible.
- POSIX-only branches (`lsof`, `/bin/sh`, a login shell for `command -v`)
  and macOS `caffeinate`, where the option does nothing.
- `terminal/index.ts` uses node-pty, which has no such option.

`windowsHide` maps to CREATE_NO_WINDOW and is ignored off Windows.
@Aikiooo
Aikiooo force-pushed the fix/windows-hide-agent-console branch from 21ee8df to 76adc26 Compare September 10, 2026 15:32
@Aikiooo Aikiooo changed the title fix(agents): hide the Windows console when spawning an agent fix(win): hide the console window for background child processes Sep 10, 2026
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