← 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
2026-04-22 12:28:20+00:00
Updated
2026-05-08 17:35:04+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

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

No evaluation history available.