authorgravatar for 142016413+chuks-qua@users.noreply.github.com(CJ) Chukwudi Nwobodo <142016413+chuks-qua@users.noreply.github.com> 2026-03-09 01:58:25+00:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-03-08 18:58:25-07:00
logb7f954a9041ee4524552ad0993e8b7711c86ff8a
tree413ab878a799ca8d54867e68c02f178ebbd428c8
parenta20815ece6ea877a2b82072339f4bced98d757f7
signature Signed by PGP key B5690EEEBB952194

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

3 files changed, 10 insertions(+), 0 deletions(-)

apps/server/scripts/cli.ts+2
......@@ -132,6 +132,7 @@ const buildCmd = Command.make(
132132 cwd: serverDir,
133133 stdout: config.verbose ? "inherit" : "ignore",
134134 stderr: "inherit",
135 // Windows needs shell mode to resolve .cmd shims (e.g. bun.cmd).
135136 shell: process.platform === "win32",
136137 })`bun tsdown`,
137138 );
......@@ -226,6 +227,7 @@ const publishCmd = Command.make(
226227 cwd: serverDir,
227228 stdout: config.verbose ? "inherit" : "ignore",
228229 stderr: "inherit",
230 // Windows needs shell mode to resolve .cmd shims.
229231 shell: process.platform === "win32",
230232 }),
231233 );
scripts/build-desktop-artifact.ts+6
......@@ -580,6 +580,8 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
580580 ChildProcess.make({
581581 cwd: repoRoot,
582582 ...commandOutputOptions(options.verbose),
583 // Windows needs shell mode to resolve .cmd shims (e.g. bun.cmd).
584 shell: process.platform === "win32",
583585 })`bun run build:desktop`,
584586 );
585587 }
......@@ -642,6 +644,8 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
642644 ChildProcess.make({
643645 cwd: stageAppDir,
644646 ...commandOutputOptions(options.verbose),
647 // Windows needs shell mode to resolve .cmd shims (e.g. bun.cmd).
648 shell: process.platform === "win32",
645649 })`bun install --production`,
646650 );
647651
......@@ -680,6 +684,8 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* (
680684 cwd: stageAppDir,
681685 env: buildEnv,
682686 ...commandOutputOptions(options.verbose),
687 // Windows needs shell mode to resolve .cmd shims.
688 shell: process.platform === "win32",
683689 })`bunx electron-builder ${platformConfig.cliFlag} --${options.arch} --publish never`,
684690 );
685691
scripts/dev-runner.ts+2
......@@ -455,6 +455,8 @@ export function runDevRunnerWithInput(input: DevRunnerCliInput) {
455455 stderr: "inherit",
456456 env,
457457 extendEnv: false,
458 // Windows needs shell mode to resolve .cmd shims (e.g. bun.cmd).
459 shell: process.platform === "win32",
458460 // Keep turbo in the same process group so terminal signals (Ctrl+C)
459461 // reach it directly. Effect defaults to detached: true on non-Windows,
460462 // which would put turbo in a new group and require manual forwarding.