Stop child process spawns and kills from flashing console windows on Windows - #7154
Conversation
🦋 Changeset detectedLatest commit: 04f2049 The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
taskkillviaexecFile+windowsHide: true—killProcessGroupandkillProcessGroupOnExitno longer route throughcmd.exe(exec), so Windows process-group kills stop spawning a console window.windowsHideonspawn— console-app children (e.g.git) are spawned hidden unless the caller explicitly setdetached: true, whose new-console intent is preserved.- Changeset —
patchfor@effect/platform-node-shared.
I verified the Windows mechanics against Node/libuv/MSDN sources. The execFile swap is the right call: execFile pipes stdio, so windowsHide maps to CREATE_NO_WINDOW (libuv applies it only when no stdio fd is inherited), suppressing the conhost window for taskkill; a child spawned with stdio: "inherit" from a console-attached parent still renders output because libuv then skips CREATE_NO_WINDOW entirely. Bare taskkill (no extension, no path) resolves via libuv's search_path in execFile exactly as it did through exec, and non-zero-exit error semantics (error.code) are preserved, so the Effect.fail behavior is unchanged. The detached === true exclusion is also sound — MSDN states CREATE_NO_WINDOW is ignored when combined with DETACHED_PROCESS, so hiding a detached child would be a silent no-op anyway. On non-Windows windowsHide is a documented no-op, and both spawn paths in this file (StandardCommand, PipedCommand) route through the changed options, so coverage is complete for this spawner. The node:child_process fork/spawn handler for detached defaults also lines up with the existing computed detached value.
No test was added — Windows-only behavior with no seam for asserting spawn options, and any test would not run on Linux CI; the author already flagged this. Mergeable as-is.
@v0 or keep the SHA fresh with Dependabot | Fix it ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
7f241b5 to
31908c0
Compare
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
There was a problem hiding this comment.
ℹ️ No critical issues — the core Windows-console fix remains sound, and the new
windowsHideoption is deterministic and genuinely exercised by the added tests. Two minor notes inline.
Reviewed changes
- Added
CommandOptions.windowsHide— an independent Windows console-hiding option that defaults to hiding non-detached children (options.windowsHide ?? !detached). - Extracted
buildSpawnOptions(exported helper) and a sharedtaskkillwrapper used by both kill paths. - Added exact-output unit tests for
buildSpawnOptionscovering the Windows defaults and the independentwindowsHideoverride — these assertions can fail, so they pin the behavior. - Rewrote the changeset description to match the new option surface.
I re-traced the defaulting matrix against the previously-approved commit: every Windows case is unchanged, and the only non-Windows shift (windowsHide true→false when detached is unset) is a no-op since libuv ignores windowsHide on non-Windows platforms.
@v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

Type
Description
On Windows, spawning a child process or killing a process group can create a console window. In an app that polls providers and shells out to
git, this shows up as bursts of black windows flashing on screen.Two causes in
NodeChildProcessSpawner:spawnnever passedwindowsHide, which Node defaults tofalse, so spawning a console executable such asgitorghcreates aconhostwindow.killProcessGroupandkillProcessGroupOnExitruntaskkillthroughNodeChildProcess.exec, andexecalways wraps its argument in%ComSpec% /d /s /c. Every process group kill therefore spawns acmd.exe.The
execwrapper is easy to confirm:detached: trueis left alone. Windows gives a detached child its own console on purpose, so hiding it would break callers that want a visible console process.detachedalready defaults tofalseon Windows, so the noisy paths are still covered.Validation
pnpm checkpnpm lintpnpm vitest run --project @effect/platform-node-shared: this package already fails 66 of 114 on Windows. The same run on an unmodifiedmainfails identically, so none of those come from this change.I did not add a test. The package has no seam for asserting the options handed to
NodeChildProcess.spawn, and mocking the module looked out of keeping with the surrounding tests. Happy to add one if you would rather have it.Interactive verification in a real Windows console remains external.
Related
Reported downstream in pingdotgg/t3code#2537, where a 5 minute provider refresh and per-command git cleanup produce a repeating burst of flashes.