Repository navigation
Fix the detach hang: one ctrl+c releases the terminal immediately - #8
Merged
Merged
Conversation
Detaching held the terminal open. The attach monitor's relay goroutine waited for the journal tailer to close its feed channel — but a detached run is still going, so its tailer never stops. The tea program had already exited and restored the terminal, yet the process sat blocked on the relay, holding the session until a second ctrl+c killed it outright (losing the detach message and exit status). The relay now abandons the feed the instant the program exits: one ctrl+c detaches cleanly, prints the re-attach hint, and exits 0 while the run keeps going. The regression test drives the monitor with piped input and discarded output, quitting with ctrl+c while the feed channel stays open — previously that hung forever, now it returns promptly. Verified live in a PTY: attach exits 0 at the ctrl+c with the detach message, and the run shows still-running afterward. 💘 Generated with Crush Assisted-by: Crush:rits/zai-org/glm-5-3
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
Detaching held the terminal open until a second ctrl+c. Root cause: the attach monitor's relay goroutine waited for the journal tailer to close its feed channel — but a detached run is still going, so its tailer never stops. The tea program had already exited and restored the terminal, yet the process sat blocked on the relay, holding the session open (and losing the detach message and exit status when the second ctrl+c killed it).
Verification
TERM=dumbso the terminal-capability queries don't stall the headless pty): attach exits 0 at the ctrl+c with the detach message printed, andrunsshows the run still running afterward.💘 Generated with Crush