The best way to control Claude Code, Codex and more from any computer or phone
Fix ChildProcess.spawn failing on Windows for .cmd shims (#495)
* fix(scripts): enable shell mode on Windows for .cmd shim resolution 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 #474 * docs: add comments explaining Windows shell spawn requirement * docs: add shell spawn comments to remaining call sites
(CJ) Chukwudi Nwobodo committed
Mar 9, 2026 at 01:58 UTC
b7f954a9041ee4524552ad0993e8b7711c86ff8a
3 files changed
+10
apps/server/scripts/cli.ts
+2
@@ -132,6 +132,7 @@ const buildCmd = Command.make(
132
cwd: serverDir,
133
stdout: config.verbose ? "inherit" : "ignore",
134
stderr: "inherit",
135
+ // Windows needs shell mode to resolve .cmd shims (e.g. bun.cmd).
136
shell: process.platform === "win32",
137
})`bun tsdown`,
138
);
@@ -226,6 +227,7 @@ const publishCmd = Command.make(
227
cwd: serverDir,
228
stdout: config.verbose ? "inherit" : "ignore",
229
stderr: "inherit",
230
+ // Windows needs shell mode to resolve .cmd shims.
231
shell: process.platform === "win32",
232
}),
233
);
scripts/build-desktop-artifact.ts
+6
@@ -580,6 +580,8 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
580
ChildProcess.make({
581
cwd: repoRoot,
582
...commandOutputOptions(options.verbose),
583
+ // Windows needs shell mode to resolve .cmd shims (e.g. bun.cmd).
584
+ shell: process.platform === "win32",
585
})`bun run build:desktop`,
586
);
587
}
@@ -642,6 +644,8 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
644
ChildProcess.make({
645
cwd: stageAppDir,
646
...commandOutputOptions(options.verbose),
647
+ // Windows needs shell mode to resolve .cmd shims (e.g. bun.cmd).
648
+ shell: process.platform === "win32",
649
})`bun install --production`,
650
);
651
@@ -680,6 +684,8 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
684
cwd: stageAppDir,
685
env: buildEnv,
686
...commandOutputOptions(options.verbose),
687
+ // Windows needs shell mode to resolve .cmd shims.
688
+ shell: process.platform === "win32",
689
})`bunx electron-builder ${platformConfig.cliFlag} --${options.arch} --publish never`,
690
);
691
scripts/dev-runner.ts
+2
@@ -455,6 +455,8 @@ export function runDevRunnerWithInput(input: DevRunnerCliInput) {
455
stderr: "inherit",
456
env,
457
extendEnv: false,
458
+ // Windows needs shell mode to resolve .cmd shims (e.g. bun.cmd).
459
+ shell: process.platform === "win32",
460
// Keep turbo in the same process group so terminal signals (Ctrl+C)
461
// reach it directly. Effect defaults to detached: true on non-Windows,
462
// which would put turbo in a new group and require manual forwarding.