fix(cli): hide console window for detached child processes on Windows - #3851
Open
dajiaohuang wants to merge 1 commit into
Open
fix(cli): hide console window for detached child processes on Windows#3851dajiaohuang wants to merge 1 commit into
dajiaohuang wants to merge 1 commit into
Conversation
Three `detached: true` spawns left `windowsHide` at its default of `false`. On Windows a detached child gets its own console window, so each of these flashed one at the user: - `telemetry/transport.ts` `flushSync()` — the exit-time telemetry flush, which fires on nearly every CLI invocation that exits with queued events - `utils/openBrowser.ts` — the `--browser-path` browser launch - `commands/previewLifecycle.ts` — the detached background preview server `utils/autoUpdate.ts` already passes `windowsHide: true`, so the intent was there; the other three were oversights rather than a deliberate difference. `windowsHide` is a documented no-op on macOS and Linux, so this changes nothing off Windows. Same rationale as the heygen-com#3379 ffmpeg fix. The `SpawnPreview` options type gains the field because the object literal is passed to a `SpawnPreview`-typed parameter, where excess-property checking would otherwise reject it. Closes heygen-com#3476
miguel-heygen
approved these changes
Sep 10, 2026
Collaborator
|
@dajiaohuang sign the commits pls |
dajiaohuang
force-pushed
the
fix/windowshide-detached-spawns
branch
from
September 11, 2026 10:51
011745b to
df122a6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add
windowsHide: trueto the threedetached: truespawns inpackages/clithat were missing it, so they stop opening a console window on Windows.src/telemetry/transport.ts(flushSync)src/utils/openBrowser.ts(openBrowser)--browser-pathbrowser launchsrc/commands/previewLifecycle.ts(spawnDetachedPreview)Why
Closes #3476.
child_process.spawn()defaultswindowsHidetofalse, and Node's docs state that on Windows adetached: truechild has its own console window. So all three sites flash a console window at the user on every invocation.flushSync()is the worst of the three: it is the process-exit flush path, so it fires on nearly every short-lived command (check,lint,keyframes,capture,snapshot,preview) that exits with queued events — not just renders.src/utils/autoUpdate.tsalready passeswindowsHide: true, so the intent was clearly there and the other three were oversights rather than a deliberate difference.How
Three one-line option additions.
windowsHideis a documented no-op on macOS and Linux, so this is inert off Windows — same rationale as the #3379 ffmpeg fix.One supporting type change:
spawnDetachedPreviewbuilds its options object as an object literal and passes it to theSpawnPreview-typeddependencies.spawn. TypeScript's excess-property check rejects a key that is not on that type, soSpawnPreview'soptionsparameter gainswindowsHide: boolean.Not in scope, deliberately:
detached: truespawns missingwindowsHide— telemetry flushSync opens a console window on nearly every CLI exit #3476. That is an architecture change and belongs in its own PR.Tests: the two existing spawn-asserting tests are extended (
telemetry/client.test.ts,commands/previewLifecycle.test.ts), andutils/openBrowser.windowsHide.test.tsis added. That last one goes in its own file rather than intoopenBrowser.test.tsto follow the repo's existing*.windowsHide.test.tsconvention (7 such files, incl.orphanCleanup.windowsHide.test.tsnext door) —openBrowser.test.tsotherwise holds only pure-function tests and never mocksspawn.Test plan
The three touched test files pass in full (36/36):
Reverting the three one-line changes makes exactly the three new assertions fail and nothing else, so the tests genuinely pin the fix rather than passing vacuously.
Also run on the changed files:
oxlint(0 warnings, 0 errors),oxfmt --check(clean),git diff --check(clean), and the repo's own pre-commit suite (tracked-artifacts, largefiles, lint, format, fallow, typecheck) viagit commit.Two caveats, stated plainly:
windowsHide/detachedsemantics quoted in the issue — which is also how the issue itself was diagnosed. Someone on Windows confirming the window is gone would be worth more than my static reasoning.bun run --filter @hyperframes/cli testis not green, but not because of this change: 28 tests in 8 unrelated files (commands/init*,commands/cloud/render,registry/publication,tts/synthesize.cache,utils/projectConfig.create,utils/skillsMirror,capture/scaffolding) fail identically with and without this patch — I checked out the base commit and reproduced the same 28 failures. They look environment-related rather than code-related.One note on the branch: it is based on
e5d89f77rather than the current tip ofmain. The patch is byte-identical either way (none of these six files changed in between) and it merges cleanly, but I am happy to rebase if you would rather review it against the tip.🤖 Generated with Claude Code