Repository navigation
fix(shell): keep the abort listener after the caller ends its side - #594
Merged
Merged
Conversation
Ending our side ('finish') doesn't stop the command, which can still run
and send output, so the signal must still be able to stop it. Release
the listener only on 'end' or 'close'. 'finish' never helped the unread
stream case anyway.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Karol Wrótniak <karol.wrotniak@droidsonroids.pl>
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.
Follow-up to #590, which was merged just before this commit was pushed.
#590 released the
shell()abort listener on'end','finish'or'close'.'finish'only means the caller ended its own (writing) side of the stream. The command can keep running and sending output after that, so the signal must still be able to stop it. It also never helped the case the review was about: a stream nobody reads never emits'finish'unless the caller ends it.This releases the listener only on
'end'(the device is done sending) or'close'.Tests
The test "should drop the abort listener once the caller ends its side" is replaced by "should still abort the command after the caller ends its side": after
stream.end(), the listener is still there,controller.abort()destroys the stream, and the listener is then gone. Putting'finish'back makes it fail.npm run lintandnpm testpass (370 passing).🤖 Generated with Claude Code