Skip to content

Fix ChildProcess.spawn failing on Windows for .cmd shims#495

Merged
t3dotgg merged 3 commits intopingdotgg:mainfrom
chuks-qua:fix/win-shell-spawn
Mar 9, 2026
Merged

Fix ChildProcess.spawn failing on Windows for .cmd shims#495
t3dotgg merged 3 commits intopingdotgg:mainfrom
chuks-qua:fix/win-shell-spawn

Conversation

@chuks-qua
Copy link
Contributor

@chuks-qua chuks-qua commented Mar 8, 2026

What

Add shell: process.platform === "win32" to all ChildProcess.make calls that spawn tools installed as .cmd shims on Windows.

Why

On Windows, bun, npm, turbo, and bunx are installed as .cmd shell wrappers. Node's child_process.spawn cannot resolve .cmd extensions without shell: true, causing PlatformError: NotFound on fresh builds (no Turbo cache).

Key Changes

  • apps/server/scripts/cli.ts: Fix bun tsdown and npm publish spawns
  • scripts/dev-runner.ts: Fix turbo spawn (the actual entry point for bun run dev:desktop)
  • scripts/build-desktop-artifact.ts: Fix bun run build:desktop, bun install --production, and bunx electron-builder spawns

Follows the same shell: process.platform === "win32" pattern already used in codexAppServerManager.ts, processRunner.ts, open.ts, CodexTextGeneration.ts, and ProviderHealth.ts.

Closes #474

Note

Force Windows shell execution for ChildProcess.make in CLI build/publish and desktop build scripts to fix .cmd shim resolution failures

Add shell: process.platform === "win32" to ChildProcess.make calls in CLI handlers and desktop build scripts to run bun, npm, turbo, and electron-builder via the Windows shell for .cmd shim resolution. See apps/server/scripts/cli.ts, scripts/build-desktop-artifact.ts, and scripts/dev-runner.ts.

📍Where to Start

Start with the CLI command handlers in apps/server/scripts/cli.ts, focusing on the buildCmd and publishCmd ChildProcess.make options.

Macroscope summarized f18574b.

@coderabbitai
Copy link

coderabbitai bot commented Mar 8, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 2c37364b-a26f-46e3-b8e7-9d6b02c1eb48

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@t3dotgg
Copy link
Member

t3dotgg commented Mar 8, 2026

Can you leave a comment as to "why" we do this in the places where it is done? This is one of those things that will silently be forgotten about and break again otherwise

@chuks-qua chuks-qua force-pushed the fix/win-shell-spawn branch 2 times, most recently from aa259c4 to f18574b Compare March 9, 2026 00:56
@chuks-qua
Copy link
Contributor Author

@t3dotgg, added the comments

On Windows, tools like `bun`, `npm`, `turbo`, and `bunx` are installed
as `.cmd` shims. Node's `child_process.spawn` cannot resolve these
without `shell: true`, causing `PlatformError: NotFound` on fresh
builds where there is no Turbo cache.

Add `shell: process.platform === "win32"` to all ChildProcess.make
calls in cli.ts, dev-runner.ts, and build-desktop-artifact.ts.

Closes pingdotgg#474
@t3dotgg t3dotgg merged commit b7f954a into pingdotgg:main Mar 9, 2026
3 checks passed
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.

fix: bun run dev:desktop fails on Windows — ChildProcess.spawn cannot resolve .cmd shims

2 participants