Repository navigation
feat: prompt confirmation on quit when terminal child processes are running - #675
Open
franckspike wants to merge 1 commit into
Open
franckspike wants to merge 1 commit into
franckspike wants to merge 1 commit into
Conversation
…unning Add an opt-in exit_protection configuration option that checks for active child processes running inside terminals before quitting Neovim. - Recursively inspect process tree under terminal root PID. - Differentiate interactive shell processes (e.g. bash, zsh, fish) from actual command children so idle shells never block quit. - Exclude zombie/dead processes. - Add safe quit wrapper handling :q, :qa, :wq, :wqa, :x, :xa via cmdline abbreviations when enabled. - Add configurable safe mapping (defaults to ZZ). - Provide user commands ToggleTermSafeQuit, ToggleTermSafeQuitAll, ToggleTermSafeWriteQuit, ToggleTermSafeWriteQuitAll. - Add unit tests for child process discovery.
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.
Problem
When running long-lived background jobs (compilations, servers, watch tasks) inside a ToggleTerm terminal, quitting Neovim (
:q,:qa,ZZ) abruptly terminates the shell and all running child processes without warning.Solution
This PR adds an opt-in
exit_protectionfeature:pgrep).bash,zsh,fish,sh, etc.) so idle terminals never trigger false alerts.vim.fn.confirm()listing affected terminals and running processes when attempting to quit.:q,:qa,:wq,:wqa,:x,:xa, andZZvia safe abbreviations and mappings.!(:q!,:qa!, etc.) bypass the check.exit_protection.enabled = false) for complete backward compatibility.Configuration