From 88cb77efbb83563e4de311d445c766e86989049b Mon Sep 17 00:00:00 2001 From: sudacode Date: Tue, 11 Aug 2026 19:02:44 -0700 Subject: [PATCH] fix(launcher): handle detached app spawn errors - Log detached app launch failures before releasing the child process --- src/main-entry-runtime.test.ts | 5 ++++- src/main-entry-runtime.ts | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main-entry-runtime.test.ts b/src/main-entry-runtime.test.ts index 3e95c9b9..a41a100e 100644 --- a/src/main-entry-runtime.test.ts +++ b/src/main-entry-runtime.test.ts @@ -37,7 +37,10 @@ test('detached app launch policy stays in the startup runtime utilities', () => assert.equal(typeof spawnDetachedApp, 'function'); assert.doesNotMatch(entrySource, /function spawnDetachedApp/); - assert.match(runtimeSource, /child\.unref\(\)/); + assert.match( + runtimeSource, + /child\.once\('error', \(error\) => \{\s*console\.error\([^;]*error\);\s*\}\);\s*child\.unref\(\)/, + ); }); test('background bootstrap exits through Electron so Chromium children shut down', () => { diff --git a/src/main-entry-runtime.ts b/src/main-entry-runtime.ts index 0816fff4..34bcfe10 100644 --- a/src/main-entry-runtime.ts +++ b/src/main-entry-runtime.ts @@ -280,6 +280,9 @@ export function spawnDetachedApp(childArgs: string[], env: NodeJS.ProcessEnv): v stdio: 'ignore', env, }); + child.once('error', (error) => { + console.error('Failed to spawn detached SubMiner app:', error); + }); child.unref(); }