From 4b3fe8058abde7aa00227e66cc83d4a2702214d3 Mon Sep 17 00:00:00 2001 From: Sparsh Date: Tue, 19 May 2026 00:57:07 +0530 Subject: [PATCH] fix(desktop): restart GitNexus server on macOS activate when all windows closed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On macOS, if the backend process crashes while all windows are closed, createWindow() on the next dock-click loaded the embedded UI against a dead server — resulting in a silent blank page with no error dialog. Call ensureGitNexusServerStarted() before createWindow() in the activate handler so the server is restarted (or verified healthy) before the window attempts to load content. --- gitnexus-desktop/src/main/main.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/gitnexus-desktop/src/main/main.ts b/gitnexus-desktop/src/main/main.ts index e0720aad5..7a6eb6f84 100644 --- a/gitnexus-desktop/src/main/main.ts +++ b/gitnexus-desktop/src/main/main.ts @@ -304,6 +304,10 @@ const spawnGitNexusServer = (): ChildProcess => { appendGitNexusServerOutput(getErrorMessage(error)); }); + childProcess.once('exit', () => { + serverReadyPromise = null; + }); + return childProcess; }; @@ -805,10 +809,12 @@ app.whenReady().then(async () => { app.on('activate', () => { if (openWindows.size === 0) { - void createWindow().catch((error) => { - showStartupError(error); - exitStartupFailure(); - }); + void ensureGitNexusServerStarted() + .then(() => createWindow()) + .catch((error) => { + showStartupError(error); + exitStartupFailure(); + }); } }); });