Fix ChildProcess.spawn failing on Windows for .cmd shims#495
Fix ChildProcess.spawn failing on Windows for .cmd shims#495t3dotgg merged 3 commits intopingdotgg:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
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 |
aa259c4 to
f18574b
Compare
|
@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
What
Add
shell: process.platform === "win32"to allChildProcess.makecalls that spawn tools installed as.cmdshims on Windows.Why
On Windows,
bun,npm,turbo, andbunxare installed as.cmdshell wrappers. Node'schild_process.spawncannot resolve.cmdextensions withoutshell: true, causingPlatformError: NotFoundon fresh builds (no Turbo cache).Key Changes
apps/server/scripts/cli.ts: Fixbun tsdownandnpm publishspawnsscripts/dev-runner.ts: Fixturbospawn (the actual entry point forbun run dev:desktop)scripts/build-desktop-artifact.ts: Fixbun run build:desktop,bun install --production, andbunx electron-builderspawnsFollows 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"toChildProcess.makecalls in CLI handlers and desktop build scripts to runbun,npm,turbo, andelectron-buildervia 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
buildCmdandpublishCmdChildProcess.makeoptions.Macroscope summarized f18574b.