attach: do not discard the shell exit status when stdin closes first - #414
Open
dob323 wants to merge 1 commit into
Open
attach: do not discard the shell exit status when stdin closes first#414dob323 wants to merge 1 commit into
dob323 wants to merge 1 commit into
Conversation
ethanpailes
reviewed
Aug 17, 2026
ethanpailes
left a comment
Contributor
There was a problem hiding this comment.
Looks great, mind rebasing?
| + (sock_to_stdout_h.is_finished() as usize); | ||
|
|
||
| if nfinished_threads > 0 { | ||
| // A finished stdin->sock thread only means our local input |
Contributor
There was a problem hiding this comment.
This comment is good but overly verbose, can you edit it down a bit?
Contributor
|
Oh, also, for all of these PRs, can you follow canonical commits? Since these are all non-breaking bugfixes, they should all start with |
The client stamps its fallback exit status of 1 into the result slot as soon as EITHER pipe thread finishes. A terminal that closes the client's stdin before the shell's ExitStatus frame arrives therefore reported 1 no matter how the shell exited. Wait the existing bounded detach window for the socket side before defaulting; the wait returns as soon as the frame lands, so a normal exit is unaffected. Regression test: close the attach client's stdin while the shell is still sleeping toward exit 19; on master the client reports 1, patched it reports 19.
dob323
force-pushed
the
fix/attach-exit-status
branch
from
August 17, 2026 20:15
4975fb1 to
de1eeba
Compare
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.
The attach client stamps its fallback exit status of 1 into the result slot as soon as EITHER pipe thread finishes. A terminal that closes the client stdin before the shell ExitStatus frame arrives therefore reported 1 no matter how the shell exited. This waits the existing bounded detach window (
MAX_DETACH_WAIT_DUR) for the socket side before defaulting; the wait returns as soon as the frame lands, so a normal exit is unaffected.Regression test
regression::stdin_close_does_not_discard_exit_status: closes the client stdin while the shell is still sleeping towardexit 19. On master the client reports 1; patched it reports 19.Running in production under our session manager for a week alongside #413. AI disclosure per the practice on #406: drafted with an AI assistant, reviewed and tested by a human before submission.