diff --git a/apps/desktop/electron/main.cjs b/apps/desktop/electron/main.cjs index c8e31becf6e..be89c6c91cf 100644 --- a/apps/desktop/electron/main.cjs +++ b/apps/desktop/electron/main.cjs @@ -6551,6 +6551,12 @@ app.on('before-quit', () => { flushDesktopLogBufferSync() closePreviewWatchers() + // Kill open PTYs before environment teardown to avoid the node-pty#904 + // ThreadSafeFunction SIGABRT race. + for (const id of [...terminalSessions.keys()]) { + disposeTerminalSession(id) + } + if (hermesProcess && !hermesProcess.killed) { hermesProcess.kill('SIGTERM') }