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(); + }); } }); });