Skip to content

feat(quit): warn before quitting when sessions have running processes (#67)#8175

Draft
MukundaKatta wants to merge 1 commit intovercel:canaryfrom
MukundaKatta:feat/confirm-on-quit
Draft

feat(quit): warn before quitting when sessions have running processes (#67)#8175
MukundaKatta wants to merge 1 commit intovercel:canaryfrom
MukundaKatta:feat/confirm-on-quit

Conversation

@MukundaKatta
Copy link
Copy Markdown

Summary

Closes #67. Adds confirmOnQuit: 'always' | 'on-running-process' | 'never' config (default on-running-process). Intercepts Electron's before-quit and shows a native dialog when any session has a live pty.

Files changed

  • typings/config.d.ts — added option to rootConfigOptions
  • app/config/config-default.json — default "confirmOnQuit": "on-running-process"
  • app/config/schema.json — kept JSON schema in sync
  • app/utils/confirm-quit.ts (new) — pure helpers hasRunningProcess, shouldAllowQuit, showQuitConfirmDialog. Treats sessions with a live pty and !ended as running.
  • app/index.ts — registers app.on('before-quit', ...) after ready. Calls shouldAllowQuit(mode, windowSet); preventDefault when user cancels. Guards re-prompts via quitConfirmed.
  • test/unit/confirm-quit.test.ts (new) — 12 ava tests via proxyquire, stubbing electron.app/electron.dialog.

Test plan

  • 12/12 new unit tests pass
  • Prettier clean on touched files
  • existing window-utils tests still pass

Skipped full yarn install (heavy postinstall); type-check on the full project not run. Helpers import only electron and the existing configOptions type.

Adds a `confirmOnQuit` config option that intercepts `before-quit` and
shows a native dialog when there are open sessions with a live pty. The
default `'on-running-process'` only prompts when needed; users can opt
in to `'always'` or out with `'never'`.

Closes vercel#67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warn upon quit

1 participant