fix: clean up on SIGHUP - #104
Open
hozantaher wants to merge 1 commit into
Open
Conversation
Closing the terminal window killed dmux on the default action, leaving tmux hooks pointed at a soon-to-be-recycled PID and the pane stuck in mouse-reporting mode. cleanTerminalExit already removes the hooks and resets the mouse; SIGHUP just never reached it.
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.
Closing the terminal window sends
SIGHUP.setupGlobalSignalHandlerswiresSIGINTandSIGTERMtocleanTerminalExit(src/index.ts:1455-1460) but neverSIGHUP, so the process dies on the default action and the teardown is skipped entirely.Two things leak as a result, both of which I hit in practice:
tmux show-hooksstill showskill -USR1 <pid>/kill -USR2 <pid>aimed at a dead PID. PIDs wrap, so an unrelated process later inherits that PID and gets signalled on every resize.zsh: command not found: 73M64.The fix is one handler —
cleanTerminalExitalready removes the hooks (src/index.ts:1372-1392) and writesMOUSE_REPORTING_DISABLE(:1414);SIGHUPsimply never reached it. No new teardown code.Test status
pnpm typecheckclean. The suite shows1 failed | 108 passed | 1 skippedboth before and after this change — the failure is the pre-existing stalegenerateCommitMessagetest, fixed separately in #103.While running the suite repeatedly I also saw
__tests__/cleanTextInput.wrap.interactions.test.tsx > wraps the full word exactly when overflow occursfail once in three runs (expected 1 to be greater than 1) on an otherwise unchanged tree, on a heavily loaded machine. It looks load-sensitive rather than related to this change; flagging it rather than touching it here.