From 472d302133b4831ebab5ada7e01c322b158298fe Mon Sep 17 00:00:00 2001 From: Jarvis Date: Thu, 2 Apr 2026 12:50:56 +0800 Subject: [PATCH] fix: add shell:true on Windows to spawn bun from npm Windows npm installs bun as a shell script (C:\Users\...\AppData\Roaming\npm\bun), not a native executable. Without shell:true, spawn() fails with ENOENT when trying to execute it. Fixes Stop hook failure: "Failed to start Bun: spawn bun ENOENT" --- plugin/scripts/bun-runner.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin/scripts/bun-runner.js b/plugin/scripts/bun-runner.js index 90ee0997..8c340cd7 100644 --- a/plugin/scripts/bun-runner.js +++ b/plugin/scripts/bun-runner.js @@ -152,11 +152,13 @@ const stdinData = await collectStdin(); // Spawn Bun with the provided script and args // Use spawn (not spawnSync) to properly handle stdio -// Note: Don't use shell mode on Windows - it breaks paths with spaces in usernames +// Use shell mode on Windows because npm-installed bun is a .cmd/.sh script, +// not a native executable. Without shell:true, spawn() fails with ENOENT. // Use windowsHide to prevent a visible console window from spawning on Windows const child = spawn(bunPath, args, { stdio: [stdinData ? 'pipe' : 'ignore', 'inherit', 'inherit'], windowsHide: true, + shell: IS_WINDOWS, env: process.env });