← Back to issue list

fix(printer): ignore broken pipe on output streams

View original Github issue

Metadata

Project
craft-cli
Number
#443
Type
pull request
State
open
Author
gcomneno
Labels
Created
Updated
Closed

Current evaluation

Ignore BrokenPipeError in printer output streams to avoid crashes when piped to early-closing consumers (e.g., head -n1). +87/-11, 2 files, unit tests. All test jobs pass; lint/OSV failures pre-existing. No maintainer review; author pinged 99 days ago.

Suggested action: needs review

Reason: The PR fixes open issue canonical/craft-cli#378 (BrokenPipeError when piping to head), which is still open and not addressed in main — grep confirms no BrokenPipeError handling exists in craft_cli/printer.py today. All test jobs pass and the author re-verified locally against current main 99 days ago, attributing the two failing checks (OSV-scanner on a generated requirements artifact, lint/files) to pre-existing diagnostics outside the diff. With 0 reviewers and the author explicitly asking whether to adjust or close, it needs a maintainer decision rather than closure.

Impact: 45 Quick Win: 31.5 Staleness: 58 Complexity: 30 Confidence: 80

Issue body

## Summary Ignore `BrokenPipeError` when writing to output streams in the printer. This avoids crashes when output is piped to an early-closing consumer (for example `head -n1`) and the downstream stream closes before craft-cli finishes writing or cleaning up the terminal/output state. ## Testing - `pytest -q tests/unit/test_printer.py -k "broken_pipe" -rs` - `pytest -q tests/unit/test_printer.py -rs` - `pytest -q tests/integration/test_messages_integration.py -k "third_party_output" -rs` - `pytest -q tests/unit/test_messages_stream_cm.py -rs` - `ruff check craft_cli/printer.py tests/unit/test_printer.py`

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 45
Quick Win: 31.5
Staleness: 58
Complexity: 30
Confidence: 80
needs review Ignore BrokenPipeError in printer output streams to avoid crashes when piped to early-closing consumers (e.g., head -n1). +87/-11, 2 files, unit tests. All test jobs pass; lint/OSV failures pre-existing. No maintainer review; author pinged 99 days ago.
qwen/qwen3.6-35b-a3b
Staleness: 60
Complexity: 15
Confidence: 85
needs review Fixes BrokenPipeError when output streams close early. Tests pass except for unrelated pre-existing CI failures. Awaiting maintainer review after 2 months of inactivity.
qwen3.6-35b-a3b-mtp-q6
Staleness: 65
Complexity: 15
Confidence: 80
needs review Catches BrokenPipeError in the printer module to prevent crashes when downstream consumers close early. Tests pass locally and against upstream; CI failures are unrelated to the diff. Awaiting maintainer review after a recent contributor follow-up.
qwen3.6-35b-a3b-mtp-q6
Staleness: 45
Complexity: 15
Confidence: 75
needs review Prevents crashes when output streams close early by ignoring BrokenPipeError in the printer. All functional tests pass, but the change is pending resolution of pre-existing lint diagnostics and an unrelated OSV-scanner policy failure.

Update history

No update history recorded yet.

Related work

  • Caused By: canonical/craft-cli#378 (confidence 85%)

    Issue reports BrokenPipeError when piping output to head and notes a contributor submitted a PR to ignore the error during output cleanup; this PR matches that description and is still unmerged.

Related issues

Issue Project State Summary Similarity
#378 Broken pipe when trimming lines (head) craft-cli 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.
72%