From 4d4b0a2f24dc9d718278f561aaacc1494879166e Mon Sep 17 00:00:00 2001 From: Jarvis Date: Thu, 2 Apr 2026 13:00:15 +0800 Subject: [PATCH] fix: prefer bun.cmd over bun shell script on Windows Windows npm installs both bun (shell script) and bun.cmd (batch file). When spawning bun, cmd.exe cannot execute the shell script directly. This change makes findBun() return the full path to bun.cmd on Windows. Fixes: Stop hook "spawn bun ENOENT" on Windows --- plugin/scripts/bun-runner.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugin/scripts/bun-runner.js b/plugin/scripts/bun-runner.js index 8c340cd7..e99d07d4 100644 --- a/plugin/scripts/bun-runner.js +++ b/plugin/scripts/bun-runner.js @@ -55,6 +55,13 @@ function findBun() { }); if (pathCheck.status === 0 && pathCheck.stdout.trim()) { + // On Windows, prefer bun.cmd over bun (bun is a shell script, bun.cmd is the Windows batch file) + if (IS_WINDOWS) { + const bunCmdPath = pathCheck.stdout.split('\n').find(line => line.trim().endsWith('bun.cmd')); + if (bunCmdPath) { + return bunCmdPath.trim(); + } + } return 'bun'; // Found in PATH }