From 12344a51cff6719c8d310bf78477cf9c4c305ab2 Mon Sep 17 00:00:00 2001 From: Jinwoo Hong <73622457+Jinwoo-H@users.noreply.github.com> Date: Tue, 31 Mar 2026 18:34:14 -0400 Subject: [PATCH] fix: capture terminal buffers before quitAndInstall (#241) Co-authored-by: Claude Opus 4.6 --- src/preload/index.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/preload/index.ts b/src/preload/index.ts index a72c15a84..64c274725 100644 --- a/src/preload/index.ts +++ b/src/preload/index.ts @@ -204,7 +204,13 @@ const api = { getVersion: (): Promise => ipcRenderer.invoke('updater:getVersion'), check: (): Promise => ipcRenderer.invoke('updater:check'), download: (): Promise => ipcRenderer.invoke('updater:download'), - quitAndInstall: (): Promise => ipcRenderer.invoke('updater:quitAndInstall'), + quitAndInstall: (): Promise => { + // Dispatch beforeunload to trigger terminal buffer capture before the + // update process bypasses the normal window close sequence (quitAndInstall + // removes close listeners, preventing beforeunload from firing naturally). + window.dispatchEvent(new Event('beforeunload')) + return ipcRenderer.invoke('updater:quitAndInstall') + }, onStatus: (callback: (status: unknown) => void): (() => void) => { const listener = (_event: Electron.IpcRendererEvent, status: unknown) => callback(status) ipcRenderer.on('updater:status', listener)