| author | |
| committer | |
| log | b7f954a9041ee4524552ad0993e8b7711c86ff8a |
| tree | 413ab878a799ca8d54867e68c02f178ebbd428c8 |
| parent | a20815ece6ea877a2b82072339f4bced98d757f7 |
| signature | Signed by PGP key B5690EEEBB952194 |
* 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 sites3 files changed, 10 insertions(+), 0 deletions(-)
apps/server/scripts/cli.ts+2| ... | ... | @@ -132,6 +132,7 @@ const buildCmd = Command.make( |
| 132 | 132 | cwd: serverDir, |
| 133 | 133 | stdout: config.verbose ? "inherit" : "ignore", |
| 134 | 134 | stderr: "inherit", |
| 135 | // Windows needs shell mode to resolve .cmd shims (e.g. bun.cmd). | |
| 135 | 136 | shell: process.platform === "win32", |
| 136 | 137 | })`bun tsdown`, |
| 137 | 138 | ); |
| ... | ... | @@ -226,6 +227,7 @@ const publishCmd = Command.make( |
| 226 | 227 | cwd: serverDir, |
| 227 | 228 | stdout: config.verbose ? "inherit" : "ignore", |
| 228 | 229 | stderr: "inherit", |
| 230 | // Windows needs shell mode to resolve .cmd shims. | |
| 229 | 231 | shell: process.platform === "win32", |
| 230 | 232 | }), |
| 231 | 233 | ); |
scripts/build-desktop-artifact.ts+6| ... | ... | @@ -580,6 +580,8 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* ( |
| 580 | 580 | ChildProcess.make({ |
| 581 | 581 | cwd: repoRoot, |
| 582 | 582 | ...commandOutputOptions(options.verbose), |
| 583 | // Windows needs shell mode to resolve .cmd shims (e.g. bun.cmd). | |
| 584 | shell: process.platform === "win32", | |
| 583 | 585 | })`bun run build:desktop`, |
| 584 | 586 | ); |
| 585 | 587 | } |
| ... | ... | @@ -642,6 +644,8 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* ( |
| 642 | 644 | ChildProcess.make({ |
| 643 | 645 | cwd: stageAppDir, |
| 644 | 646 | ...commandOutputOptions(options.verbose), |
| 647 | // Windows needs shell mode to resolve .cmd shims (e.g. bun.cmd). | |
| 648 | shell: process.platform === "win32", | |
| 645 | 649 | })`bun install --production`, |
| 646 | 650 | ); |
| 647 | 651 | |
| ... | ... | @@ -680,6 +684,8 @@ const buildDesktopArtifact = Effect.fn("buildDesktopArtifact")(function* ( |
| 680 | 684 | cwd: stageAppDir, |
| 681 | 685 | env: buildEnv, |
| 682 | 686 | ...commandOutputOptions(options.verbose), |
| 687 | // Windows needs shell mode to resolve .cmd shims. | |
| 688 | shell: process.platform === "win32", | |
| 683 | 689 | })`bunx electron-builder ${platformConfig.cliFlag} --${options.arch} --publish never`, |
| 684 | 690 | ); |
| 685 | 691 |
scripts/dev-runner.ts+2| ... | ... | @@ -455,6 +455,8 @@ export function runDevRunnerWithInput(input: DevRunnerCliInput) { |
| 455 | 455 | stderr: "inherit", |
| 456 | 456 | env, |
| 457 | 457 | extendEnv: false, |
| 458 | // Windows needs shell mode to resolve .cmd shims (e.g. bun.cmd). | |
| 459 | shell: process.platform === "win32", | |
| 458 | 460 | // Keep turbo in the same process group so terminal signals (Ctrl+C) |
| 459 | 461 | // reach it directly. Effect defaults to detached: true on non-Windows, |
| 460 | 462 | // which would put turbo in a new group and require manual forwarding. |