diff --git a/scripts/hooks/plugin-hook-bootstrap.js b/scripts/hooks/plugin-hook-bootstrap.js index fd31a6930..00fce645a 100644 --- a/scripts/hooks/plugin-hook-bootstrap.js +++ b/scripts/hooks/plugin-hook-bootstrap.js @@ -6,6 +6,8 @@ const path = require('path'); const { spawnSync } = require('child_process'); const { ensureAgentDataHomeEnv } = require('../lib/agent-data-home'); +const SHELL_PROBE_TIMEOUT_MS = 2000; + function readStdinRaw() { try { return fs.readFileSync(0, 'utf8'); @@ -95,7 +97,7 @@ function findShellBinary() { const probe = spawnSync(candidate, isPowerShellBin(candidate) ? psProbeArgs : shProbeArgs, { stdio: 'ignore', windowsHide: true, - timeout: 30000, + timeout: SHELL_PROBE_TIMEOUT_MS, }); // A candidate is only usable if it both spawns AND exits cleanly. The // Windows System32 bash.exe WSL launcher spawns without error but exits @@ -120,7 +122,11 @@ function findBashBinary() { candidates.push('bash.exe', 'bash'); for (const candidate of candidates) { - const probe = spawnSync(candidate, ['-c', ':'], { stdio: 'ignore', windowsHide: true, timeout: 30000 }); + const probe = spawnSync(candidate, ['-c', ':'], { + stdio: 'ignore', + windowsHide: true, + timeout: SHELL_PROBE_TIMEOUT_MS, + }); // Require a clean exit, not just a successful spawn: the Windows System32 // bash.exe WSL stub spawns fine but exits non-zero with no distro installed. if (!probe.error && probe.status === 0) {