feat(quit): warn before quitting when sessions have running processes (#67)#8175
Draft
MukundaKatta wants to merge 1 commit intovercel:canaryfrom
Draft
feat(quit): warn before quitting when sessions have running processes (#67)#8175MukundaKatta wants to merge 1 commit intovercel:canaryfrom
MukundaKatta wants to merge 1 commit intovercel:canaryfrom
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #67. Adds
confirmOnQuit: 'always' | 'on-running-process' | 'never'config (defaulton-running-process). Intercepts Electron'sbefore-quitand shows a native dialog when any session has a live pty.Files changed
typings/config.d.ts— added option torootConfigOptionsapp/config/config-default.json— default"confirmOnQuit": "on-running-process"app/config/schema.json— kept JSON schema in syncapp/utils/confirm-quit.ts(new) — pure helpershasRunningProcess,shouldAllowQuit,showQuitConfirmDialog. Treats sessions with a liveptyand!endedas running.app/index.ts— registersapp.on('before-quit', ...)afterready. CallsshouldAllowQuit(mode, windowSet); preventDefault when user cancels. Guards re-prompts viaquitConfirmed.test/unit/confirm-quit.test.ts(new) — 12 ava tests via proxyquire, stubbingelectron.app/electron.dialog.Test plan
existing window-utilstests still passSkipped full
yarn install(heavy postinstall); type-check on the full project not run. Helpers import onlyelectronand the existingconfigOptionstype.