Skip to content

fix(shell): keep the abort listener after the caller ends its side - #594

Merged
koral-- merged 1 commit into
masterfrom
fix/shell-abort-finish
Nov 20, 2026
Merged

koral-- merged 1 commit into
masterfrom
fix/shell-abort-finish

Conversation

@koral--

@koral-- koral-- commented Nov 20, 2026

Copy link
Copy Markdown
Member

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 lint and npm test pass (370 passing).

🤖 Generated with Claude Code

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>
@koral--
koral-- merged commit 9652b84 into master Nov 20, 2026
6 checks passed
@koral--
koral-- deleted the fix/shell-abort-finish branch November 20, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant