diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts index b7c095ba86..fd72f710d7 100644 --- a/apps/desktop/electron/main.ts +++ b/apps/desktop/electron/main.ts @@ -14105,9 +14105,17 @@ function registerDeepLinkProtocol() { // second-instance argv. Without the lock a second `hermes://` launch spawns a // whole new app instead of routing into the running one. const _gotSingleInstanceLock = app.requestSingleInstanceLock() +const isPrimaryInstance = _gotSingleInstanceLock -if (!_gotSingleInstanceLock) { - app.quit() +if (!isPrimaryInstance) { + // Hard-exit, not app.quit(): the before-quit teardown coordinator defers a + // plain quit (event.preventDefault + async backend shutdown), and in that + // window `ready` still fires — the lock-losing instance then runs the full + // startup (shortcut registration, createWindow → startHermes), whose + // reapOrphans() SIGTERMs the running instance's live backend (#87295). + // app.exit() terminates immediately, before `ready`, so a second launch + // routes into the running window and never touches backend machinery. + app.exit(0) } else { app.on('second-instance', (_event, argv) => { const url = _extractDeepLink(argv)