Repository navigation
Handle closed output pipes without a traceback - #248
Open
2836048681 wants to merge 1 commit into
Open
2836048681 wants to merge 1 commit into
2836048681 wants to merge 1 commit into
Conversation
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.
Fixes #52.
When a consumer such as
headcloses its end of a pipeline, Argh currentlyraises
BrokenPipeErrorwhile writing a command's results. Small outputs canfail later, during Python's shutdown flush, and print an ignored exception.
Catch
BrokenPipeErroraround output writes and flushes, stop consuming furtherresults, and close the broken stream to prevent another flush at shutdown.
Flush buffered output when dispatching finishes so small results take the same
error-handling path. Keep command execution and result string conversion outside
the exception handler; their errors and unrelated output errors still propagate.
Add regressions for writes, newlines, per-line and final flushing, cleanup after
a failed close, raw output, and exception propagation. Four subprocess cases
exercise real closed pipes with small and large results and both flush modes.
Document the output-stream behavior and add a changelog entry.
Validation
namespace deprecation warning. Linux, Python 3.12.3, pytest 9.2.0.
head -n 10pipeline changed from producer exit 1 with a tracebackto producer/consumer exit 0 with exactly ten output lines and empty stderr.
--ignore-missing-importspassed for all 24 source/test files.git diff --checkpassed.To rerun the full tests from the checkout:
Supervisor handoff
bugandcomponent-dispatching.fix/52-handle-broken-output-pipes.9e9b820fd0244977b770e4503cbec84238edce01.master,8d25286693d5b35e7348bbac1521e286aac85c01; clone made withgit clone --depth 1./home/hatch/workspace/pr-factory/work/w01-r93/repo.src/argh/dispatching.py,tests/test_dispatching.py,CHANGELOG.rst.shortlist.md; prior completed worker-01repositories excluded. No
PREV-LEDGER.mdwas present.the all-state issue-number/broken-pipe search or the 12 open repository PRs.
The owner-open-PR search returned zero.
evidence/andscreening/; review package:ready/argh-52/.authentication used.
Placement limitation:
../ready-w01-r93.md,../LEDGER-w01.md, and thefactory-wide ready/ledger destinations are outside the writable root on a
read-only mount. This draft and
LEDGER-w01.mdare complete local handoff copiesfor supervisor placement. Mount evidence is in
evidence/handoff-paths.json.Check scope: project-pinned pre-commit environments and the Python/OS CI matrix
were not run. The passing Ruff/MyPy versions are stated above. An exploratory
MyPy 2.1.0 run without ignore flags reports the same two diagnostics on this
change and the untouched base (optional argcomplete import and an existing
argparse override); both logs are in
evidence/.Fixes #52.