Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: handle synchronous CLI probe spawn failures
[._.]/ Adam Eivy2350cf8ce96c
diff --git a/server/lib/commandExists.js b/server/lib/commandExists.jsindex 2dba163bd1..0ba6bb7d43 100644--- a/server/lib/commandExists.js+++ b/server/lib/commandExists.js@@ -25,5 +25,12 @@ export async function commandExists(cmd, args = ['--version'], { timeoutMs = 5_0...(env === undefined ? {} : { env }),...(cwd === undefined ? {} : { cwd }),};- return execFileAsync(cmd, args, options).then(() => true).catch(() => false);+ // Some spawn failures (notably ENOEXEC for a broken text shim on macOS)+ // are thrown synchronously by the child-process wrapper before it can+ // return a promise. Start the call in a microtask so those failures follow+ // the same false result as an ordinary rejected execFile promise.+ return Promise.resolve()+ .then(() => execFileAsync(cmd, args, options))+ .then(() => true)+ .catch(() => false);}diff --git a/server/lib/commandExists.test.js b/server/lib/commandExists.test.jsindex 2637005532..d5cbdbde8d 100644--- a/server/lib/commandExists.test.js+++ b/server/lib/commandExists.test.js@@ -21,6 +21,11 @@ describe('commandExists', () => {await expect(commandExists('nope', ['--version'])).resolves.toBe(false)})+ it('resolves false when spawning throws synchronously (e.g. ENOEXEC)', async () => {+ execFileMock.impl = () => { throw Object.assign(new Error('ENOEXEC'), { code: 'ENOEXEC' }) }+ await expect(commandExists('broken-shim', ['--version'])).resolves.toBe(false)+ })+it('defaults args to ["--version"] when omitted', async () => {let seenArgs = nullexecFileMock.impl = (_cmd, args, _opts, cb) => { seenArgs = args; cb(null, { stdout: '', stderr: '' }) }