From 6664190888066c1aa6a80ae6bce32f58a69a078f Mon Sep 17 00:00:00 2001 From: Fabio Date: Mon, 4 May 2026 22:53:29 +0200 Subject: [PATCH] fix(hooks): execFileSync 'npm' needs shell:true on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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",...} --- hooks/gsd-check-update-worker.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hooks/gsd-check-update-worker.js b/hooks/gsd-check-update-worker.js index 8c2250870..e6b7f6d58 100644 --- a/hooks/gsd-check-update-worker.js +++ b/hooks/gsd-check-update-worker.js @@ -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) {}