fix(transport): handle clean process exit in read_messages to trigger teardown#1137
Open
anishesg wants to merge 1 commit into
Open
fix(transport): handle clean process exit in read_messages to trigger teardown#1137anishesg wants to merge 1 commit into
anishesg wants to merge 1 commit into
Conversation
… teardown The read_messages function in subprocess_cli.py only raised ProcessError when the CLI process exited with a nonzero returncode. This left the clean exit case (returncode=0) unhandled, meaning read_messages would return silently without signaling that the CLI had terminated. The caller had no explicit indication that the process had exited, preventing proper cleanup and teardown. Signed-off-by: anish <anishesg@users.noreply.github.com>
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 read_messages function in subprocess_cli.py only raised ProcessError when the CLI process exited with a nonzero returncode. This left the clean exit case (returncode=0) unhandled, meaning read_messages would return silently without signaling that the CLI had terminated. The caller had no explicit indication that the process had exited, preventing proper cleanup and teardown.
The fix explicitly handles both clean exit (returncode==0) and error exit (nonzero returncode) by raising ProcessError in both cases. For clean exits, ProcessError is raised with exit_code=0 and stderr=None to distinguish it from error exits. This ensures read_messages unblocks promptly and signals CLI termination to the caller, enabling proper resource cleanup regardless of exit status.
The change makes read_messages behavior consistent with the write() function, which already detects and rejects writes to terminated processes regardless of exit code.
Fixes #1133