fix: run tmux teardown when Ink exits - #108
Open
hozantaher wants to merge 1 commit into
Open
Conversation
exitOnCtrlC is false and the app handles Ctrl+C itself, so quitting unmounts Ink without raising SIGINT and the signal handler's teardown never runs. The session then keeps hooks aimed at a PID about to be recycled.
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.
Quitting dmux with its own Ctrl+C leaves the session's tmux hooks installed.
render()is called withexitOnCtrlC: false(src/index.ts:670) and the app handles the key itself —FooterHelp.tsx:36prints Press Ctrl+C again to exit, handled inuseInputHandling.ts:1212. So quitting unmounts Ink without ever raising SIGINT, andcleanTerminalExitnever runs.The Ink exit path (
src/index.ts:673) only reset mouse reporting and calledprocess.exit(0). Compare with the signal path (:1421-1426), which also removes the resize / pane-split / pane-focus hooks, the remote-pane bindings and the session runtime metadata. Net effect: after a normal Ctrl+C quit,tmux show-hooksstill listskill -USR1 <pid>/kill -USR2 <pid>for a dead PID — and since PIDs are recycled, an unrelated process later gets those signals on resize (SIGUSR1 defaults to terminate).This repeats the same teardown on the Ink exit path, guarded by the existing
claimProcessShutdownso the two paths stay exclusive.Reported by a user who hit it reliably: "it happens when I switch to the left pane and press Ctrl+C to quit". It matches the dangling hooks I kept finding on that machine.
Verification — what is and isn't proven
pnpm typecheckclean; suite unchanged (the one failure is the pre-existing stalegenerateCommitMessagetest, fixed in #103).Not verified end to end. I tried an A/B in a detached tmux server and it was inconclusive: both the patched and unpatched builds ended with zero hooks, which means the harness exercised the SIGINT path rather than the app's own key handling — a detached pane does not reproduce the interactive raw-mode quit. I am reporting that rather than dressing it up. The change is justified by the code paths above, not by a passing test; if you would rather see a regression test first, say so and I will find a harness that genuinely reaches the Ink exit.
Complements #104 (SIGHUP): together they close both routes by which dmux currently exits without teardown.