[containers-shared] Fix Docker spawn opening console windows on Windows#13017
[containers-shared] Fix Docker spawn opening console windows on Windows#13017petebacondarwin wants to merge 1 commit intomainfrom
Conversation
🦋 Changeset detectedLatest commit: 777809a The changes in this PR will be included in the next version bump. 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 |
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
|
✅ All changesets look good |
|
I've reviewed the full diff and both affected files. Let me now analyze the changes:
The logic is sound, the platform checks are correct, and the comments are accurate. LGTM |
create-cloudflare
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
wrangler
commit: |
On Windows, `detached: true` in child_process.spawn() gives each child process its own visible console window. This caused many windows to flash open during `wrangler deploy` with `[[containers]]` configured. - Set `detached` conditionally: true on Unix (for process group cleanup), false on Windows (to prevent console windows) - Add `windowsHide: true` to further suppress console windows on Windows - Guard `process.kill(-pid)` abort logic: use `child.kill()` on Windows since negative-PID process group kill is Unix-only Fixes #12963
ad73c62 to
777809a
Compare
Fixes #12963.
When running
wrangler deployon Windows with[[containers]]configured, the Docker build step spawns numerous console windows that flash open during the build process.This is caused by
detached: trueinchild_process.spawn()calls — on Windows,detached: truegives each child process its own visible console window (Node.js docs).The fix:
detachedconditionally:trueon Unix/macOS (needed for process group cleanup viaprocess.kill(-pid)),falseon WindowswindowsHide: trueto further suppress console windows on Windows (no-op on other platforms)process.kill(-child.pid)abort logic with a platform check: useschild.kill()on Windows since negative-PID process group kill is a Unix-only conceptBoth
dockerBuild()inbuild.tsandrunDockerCmd()inutils.tsare updated.detachedandwindowsHideoptions). Existing tests pass. The behavior difference is only observable on Windows with Docker Desktop, which cannot be tested in CI. The logic change is minimal and well-documented in Node.js docs.