fix(desktop): restart GitNexus server on macOS activate when all windows closed

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.
This commit is contained in:
Sparsh 2026-05-19 00:57:07 +05:30
parent 170a625438
commit 4b3fe8058a

View file

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