Repository navigation
fix(zsh): stop the spinner from running shell-exit cleanup - #76
Merged
Merged
Conversation
A query could freeze with the spinner stuck mid-frame, and each one left a stopped background job (the prompt's job count kept climbing). Since v1.8.21 cleanup is a zshexit hook instead of an EXIT trap. zsh also runs zshexit hooks when a subshell calls `exit`, and the spinner does that on SIGTERM. So every lacy_stop_spinner ran lacy_shell_cleanup inside the spinner: it restored MONITOR, the next fork (`command rm`) took its own process group and stopped on SIGTTOU, and the spinner never exited. Before v1.8.24 the stop path then blocked in `wait` forever; after it, the stuck spinner was abandoned as a stopped job. - lacy_shell_cleanup returns early outside the main shell (ZSH_SUBSHELL) - the spinner clears zshexit_functions so no plugin's exit hook runs there - test_zsh_adapter: stopping the spinner must end it (fails before the fix)
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.
Queries could freeze with the spinner stuck mid-frame. Every query also left a stopped background job behind, which showed up as a climbing job count in the prompt (
✦2).Cause. In v1.8.21 (c63b017), cleanup moved from
trap … EXITto azshexithook. zsh also runszshexithooks when a subshell callsexit, and the spinner does that on SIGTERM. Solacy_stop_spinnerwas runninglacy_shell_cleanupinside the spinner. That cleanup restored MONITOR, so its first fork (command rm) got its own process group and was stopped by SIGTTOU. The spinner then never exited. On v1.8.21 to v1.8.23 the stop path waited on it forever, freezing the shell. Since v1.8.24 the stuck spinner gets abandoned as a stopped job instead.Fix
lacy_shell_cleanupreturns early unlessZSH_SUBSHELL == 0.zshexit_functions, so no plugin's exit hook runs there.Verified
test_zsh_adapter.zsh("stopping the spinner ends it"). It fails on main (SPINNER=alive) and passes with the fix.script/test.sh: 19/19 suites pass (bash, zsh, fish, installer).lash(server never comes up, falls back to single-shot) left a stopped job on every run of main (2/2) and of the installed v1.8.21 (3/3). With the fix: 0/4, and the answer prints.