fix(hooks): execFileSync 'npm' needs shell:true on Windows
Without shell:true, execFileSync('npm', ...) on Windows fails with
ENOENT because npm is distributed as npm.cmd, not as a literal 'npm'
binary. The silent try/catch swallows the error, latest stays null,
update_available becomes null, and the statusline never shows
"⬆ /gsd-update" — Windows users miss every release.
Adding shell:true makes execFileSync route through cmd.exe which
resolves npm.cmd via PATHEXT, identical behavior on POSIX.
Repro on Windows:
$env:GSD_CACHE_FILE = "$env:USERPROFILE\.cache\gsd\gsd-update-check.json"
node ~\.claude\hooks\gsd-check-update-worker.js
Get-Content "$env:USERPROFILE\.cache\gsd\gsd-update-check.json"
Before: {"update_available":null,"installed":"1.40.0","latest":"unknown",...}
After: {"update_available":false,"installed":"1.40.0","latest":"1.40.0",...}
This commit is contained in:
@@ -93,6 +93,11 @@ try {
|
||||
encoding: 'utf8',
|
||||
timeout: 10000,
|
||||
windowsHide: true,
|
||||
// shell:true is required on Windows so 'npm' resolves to npm.cmd via PATHEXT.
|
||||
// Without it, execFileSync looks for a literal 'npm' binary, fails with ENOENT,
|
||||
// the catch swallows the error, latest stays null, and the statusline never shows
|
||||
// the "⬆ /gsd-update" indicator on Windows.
|
||||
shell: true,
|
||||
}).trim();
|
||||
} catch (e) {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user