From 3fb6bfbb503caf9477125f6a73f2c1b762953467 Mon Sep 17 00:00:00 2001 From: superresistant Date: Mon, 19 Jan 2026 21:50:30 +0100 Subject: [PATCH] fix(hooks): prevent console window flash on Windows (#167) On Windows, the detached spawn option creates a visible console window. Combined with npm (which is a .cmd batch file), this causes a brief window flash that steals focus from the user's terminal. - Remove detached: true (not needed, child.unref() handles non-blocking) - Add windowsHide: true to both spawn() and inner execSync() --- hooks/gsd-check-update.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hooks/gsd-check-update.js b/hooks/gsd-check-update.js index df83bb929..d8e30c547 100755 --- a/hooks/gsd-check-update.js +++ b/hooks/gsd-check-update.js @@ -17,7 +17,7 @@ if (!fs.existsSync(cacheDir)) { fs.mkdirSync(cacheDir, { recursive: true }); } -// Run check in background (spawn detached process) +// Run check in background (spawn background process, windowsHide prevents console flash) const child = spawn(process.execPath, ['-e', ` const fs = require('fs'); const { execSync } = require('child_process'); @@ -32,7 +32,7 @@ const child = spawn(process.execPath, ['-e', ` let latest = null; try { - latest = execSync('npm view get-shit-done-cc version', { encoding: 'utf8', timeout: 10000 }).trim(); + latest = execSync('npm view get-shit-done-cc version', { encoding: 'utf8', timeout: 10000, windowsHide: true }).trim(); } catch (e) {} const result = { @@ -44,8 +44,8 @@ const child = spawn(process.execPath, ['-e', ` fs.writeFileSync(cacheFile, JSON.stringify(result)); `], { - detached: true, - stdio: 'ignore' + stdio: 'ignore', + windowsHide: true }); child.unref();