Repository navigation
fix(macos): exit process cleanly after cleanup on quit (#644) - #650
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe shutdown cleanup path now calls ChangesShutdown exit handling
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to After cleanup, normal quit paths now terminate the application with the computed exit code, fixing the macOS first-quit hang while preserving updater handoff behavior. No current merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the problem, root cause, solution, and linked issue, but it omits most required template sections, including Scope, Verification commands and results, Compatibility & data safety, Screenshots, and the contributor checklist.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThis PR changes successful shutdown completion to call
Confidence Score: 5/5The PR appears safe to merge because required cleanup still completes before direct termination and update installation retains control of its own shutdown path. The changed branch preserves the existing exit code, destroys the window after cleanup, and skips
|
| Filename | Overview |
|---|---|
| main/shutdown.ts | Replaces the post-cleanup zero-code app.quit() retry with direct process termination while retaining cleanup and update-install guards. |
| tests/shutdown-lifecycle.test.ts | Updates normal-quit expectations to assert app.exit(0) and verifies update installation still suppresses direct exit. |
Sequence Diagram
sequenceDiagram
participant User
participant Electron
participant Shutdown
participant Cleanup
User->>Electron: Quit / Cmd+Q
Electron->>Shutdown: will-quit
Shutdown-->>Electron: preventDefault()
Shutdown->>Cleanup: runCleanup()
Cleanup-->>Shutdown: completed
Shutdown->>Shutdown: destroyWindow()
alt Installing update
Shutdown-->>Electron: Let quitAndInstall own termination
else Normal quit
Shutdown->>Electron: app.exit(exitCode)
end
Reviews (1): Last reviewed commit: "fix(macos): exit process cleanly after c..." | Re-trigger Greptile
Fixes #644
Problem
On macOS, closing the application window hides it to the Dock. However, when right-clicking the app in the Dock and selecting Quit (or pressing Cmd+Q), the app only partially quits:
will-quitprevents default to run asynchronous cleanup.app.quit()was called.app.quit()from an asynchronous Promise callback does not re-terminate the headless Cocoa run loop, leaving the process in the Dock as an unresponsive zombie requiring a second quit.Solution
main/shutdown.ts, afterrunCleanup()completes and verifies!isInstallingUpdate(), callapp.exit(exitCode)directly (matching the non-zero and signal exit paths), ensuring the process cleanly terminates on the first quit attempt.tests/shutdown-lifecycle.test.tsto assert thatapp.exitCodesreceives[0]on completed cleanup.Summary by CodeRabbit
Bug Fixes
Tests