Skip to content

Commit 5deadbc

Browse files
fix(electron): quit app on window-all-closed to kill sidecar on macOS
On macOS, closing all Electron windows does not quit the application — the process stays alive in the Dock and the opencode-cli sidecar keeps running indefinitely, leaking CPU and memory. Add a window-all-closed handler that kills the sidecar and quits the app, ensuring cleanup matches the before-quit/will-quit handlers. Fixes anomalyco#17068
1 parent cccb907 commit 5deadbc

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

  • packages/desktop-electron/src/main

‎packages/desktop-electron/src/main/index.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ function setupApp() {
9494
killSidecar()
9595
})
9696

97+
// On macOS, closing all windows does not quit the app by default —
98+
// the process stays alive in the Dock with the sidecar still running.
99+
// Explicitly quit so the sidecar is cleaned up via before-quit/will-quit.
100+
app.on("window-all-closed", () => {
101+
killSidecar()
102+
app.quit()
103+
})
104+
97105
for (const signal of ["SIGINT", "SIGTERM"] as const) {
98106
process.on(signal, () => {
99107
killSidecar()

0 commit comments

Comments
 (0)