Merge pull request #3102 from fabiossj83/fix/windows-npm-execfilesync-shell-true

fix(hooks): gsd-check-update-worker — execFileSync 'npm' needs shell:true on Windows
This commit is contained in:
Tom Boucher
2026-05-06 20:55:48 -04:00
committed by GitHub
3 changed files with 111 additions and 0 deletions

View File

@@ -93,6 +93,13 @@ try {
encoding: 'utf8',
timeout: 10000,
windowsHide: true,
// On Windows, 'npm' is distributed as npm.cmd. Node's execFileSync does
// not apply PATHEXT resolution and looks for a literal 'npm' binary,
// failing with ENOENT. Setting shell:true on Windows routes through
// cmd.exe which resolves npm.cmd via PATHEXT.
// POSIX (Linux/macOS) is left untouched — no shell spawn, no extra
// signal/exit-code semantics, no overhead.
shell: process.platform === 'win32',
}).trim();
} catch (e) {}