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
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user