← Back to issue list

Broken pipe when trimming lines (head)

View original Github issue

Metadata

Project
craft-cli
Number
#378
Type
issue
State
closed
Author
sergiusens
Labels
—
Created
Updated
Closed

Current evaluation

BrokenPipeError when piping craft-cli output into `head` was fixed by merged PR canonical/craft-cli#443 (commit 15f312f), which makes the printer ignore broken pipes on write and stream cleanup; issue #378 closed as resolved.

Resolution: closed resolved

Reason: PR craft-cli#443 ("fix(printer): ignore broken pipe on output streams") was merged as commit 15f312f, adding a broken-pipe-swallowing write helper in craft_cli/printer.py plus unit/integration tests asserting no BrokenPipeError reaches stderr; maintainer sergiusens referenced the CPython discussion and closed #378.

Evaluated by: mr-cal-bot

No scores available.

Issue body

``` ❯ snapcraft revisions snapcraft | head -n1 stead. The old name will be removed in a future release. Rev. Uploaded Arches Version Channels Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'> BrokenPipeError: [Errno 32] Broken pipe ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved BrokenPipeError when piping craft-cli output into `head` was fixed by merged PR canonical/craft-cli#443 (commit 15f312f), which makes the printer ignore broken pipes on write and stream cleanup; issue #378 closed as resolved.
stealth/space-bunny-alpha — closed resolved Fixed by merged craft-cli PR #443, commit 15f312f: printer writes and cleanup suppress BrokenPipeError, so piping output to early-closing commands such as head no longer errors.
qwen/qwen3.6-35b-a3b
Impact: 30
Quick Win: 22
Complexity: 10
Confidence: 85
Actionability: 80
close resolved BrokenPipeError when piping output to head -n1. Fix already implemented in craft_cli/printer.py via _safe_print with suppress(BrokenPipeError).
qwen/qwen3.8-27b
Impact: 25
Quick Win: 20
Staleness: 45
Complexity: 20
Confidence: 85
Support Request: 5
keep open BrokenPipeError traceback when piping snapcraft output to an early-closing consumer like `head -n1`. Fix is scoped to ignoring BrokenPipeError in the printer's stream handling; draft PR #443 is open and awaiting review.
qwen/qwen3.6-35b-a3b
Staleness: 65
Complexity: 15
Confidence: 85
Support Request: 0
needs triage Reports a BrokenPipeError when piping snapcraft output to head. A contributor analyzed the stream handling and submitted a draft PR to gracefully ignore the error during output cleanup.
qwen3.6-35b-a3b-mtp-q6
Staleness: 65
Complexity: 15
Confidence: 85
Support Request: 0
keep open Reports a BrokenPipeError when piping snapcraft output to head. A contributor analyzed the stream handling and submitted draft PR #443 to catch the exception during printer cleanup. Awaiting maintainer review.

Update history

Date Change
closed

Related work

  • Likely Fixed By: canonical/craft-cli#443 (confidence 97%)

    Merged PR cited in the issue comments as the narrow fix, merged in commit 15f312f; code and tests confirmed present in craft_cli/printer.py and tests.

Related issues

Issue Project State Summary Similarity
#721 charmcraft revisions Broken pipe on head / tail commands charmcraft closed Resolved in Charmcraft 2.0.0 through enhanced Craft CLI output handling in merged PR #635 (commit d36b21d8); piping revisions output to head no longer raises BrokenPipeError.
77%
#443 fix(printer): ignore broken pipe on output streams craft-cli merged Merged in canonical/craft-cli#443 via commit 15f312f, making printer output ignore BrokenPipeError and avoid crashes when downstream consumers close early.
76%
#1779154 BrokenPipeError when `| head`ing output snapcraft (launchpad) open Piping any snapcraft command's output to `head` (e.g. `snapcraft revisions multipass | head`) emits a spurious BrokenPipeError at exit; no SIGPIPE/BrokenPipe handling exists in the codebase or its history.
74%