From cf7cd2351ad4c5822535b60294968cba515e1b87 Mon Sep 17 00:00:00 2001 From: Nediar Date: Wed, 5 Aug 2026 17:07:37 -0300 Subject: [PATCH] fix: execute pnpm with shell on Windows Fixes ENOENT and EINVAL errors when running pnpm via child_process execFileSync on Windows by ensuring it runs with shell: true. Co-authored-by: Gemini --- packages/gatekeeper-context/build-app.mjs | 2 +- packages/gatekeeper-scheduler/build-app.mjs | 2 +- run-dev-server.js | 2 +- scripts/release/build-release.mjs | 2 +- scripts/run-local.mjs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/gatekeeper-context/build-app.mjs b/packages/gatekeeper-context/build-app.mjs index ffeeefa2..b9e71fcb 100644 --- a/packages/gatekeeper-context/build-app.mjs +++ b/packages/gatekeeper-context/build-app.mjs @@ -15,5 +15,5 @@ console.log( execFileSync( "pnpm", ["exec", "vite", "build", "-c", "vite.config.ts", ...(watch ? ["--watch"] : [])], - { cwd: pkgDir, stdio: "inherit" }, + { cwd: pkgDir, stdio: "inherit", shell: process.platform === "win32" }, ); diff --git a/packages/gatekeeper-scheduler/build-app.mjs b/packages/gatekeeper-scheduler/build-app.mjs index fa5ccb87..e772e0df 100644 --- a/packages/gatekeeper-scheduler/build-app.mjs +++ b/packages/gatekeeper-scheduler/build-app.mjs @@ -8,5 +8,5 @@ const watch = process.argv.includes("--watch"); execFileSync( "pnpm", ["exec", "vite", "build", "-c", "vite.config.ts", ...(watch ? ["--watch"] : [])], - { cwd: packageDirectory, stdio: "inherit" }, + { cwd: packageDirectory, stdio: "inherit", shell: process.platform === "win32" }, ); diff --git a/run-dev-server.js b/run-dev-server.js index a5aba890..089d4402 100644 --- a/run-dev-server.js +++ b/run-dev-server.js @@ -323,7 +323,7 @@ console.log(`\nStarting: wrangler dev ${args.join(" ")}\n`); try { execFileSync("pnpm", ["exec", "wrangler", "dev", ...args], - { stdio: "inherit", cwd: ROOT }); + { stdio: "inherit", cwd: ROOT, shell: process.platform === "win32" }); } catch (e) { // wrangler was killed or exited with an error; the output was already shown // via stdio: "inherit", so just propagate the exit code. diff --git a/scripts/release/build-release.mjs b/scripts/release/build-release.mjs index 8bbf4f12..97ada1b5 100644 --- a/scripts/release/build-release.mjs +++ b/scripts/release/build-release.mjs @@ -42,7 +42,7 @@ function parseArgs(argv) { function run(command, argv, options = {}) { console.log(`running: ${command} ${argv.join(" ")} ${options.cwd ? `(in ${options.cwd})` : ""}`); - execFileSync(command, argv, { stdio: "inherit", cwd: ROOT, ...options }); + execFileSync(command, argv, { stdio: "inherit", cwd: ROOT, shell: process.platform === "win32", ...options }); } function gitCommit() { diff --git a/scripts/run-local.mjs b/scripts/run-local.mjs index ac0d5898..41fbacb9 100644 --- a/scripts/run-local.mjs +++ b/scripts/run-local.mjs @@ -115,7 +115,7 @@ const needsInstall = needsBuild || !existsSync(NODE_MODULES); function run(cmd, args) { console.log(`\n> ${cmd} ${args.join(" ")}`); - execFileSync(cmd, args, { stdio: "inherit", cwd: ROOT }); + execFileSync(cmd, args, { stdio: "inherit", cwd: ROOT, shell: process.platform === "win32" }); } if (needsInstall) {