fix(messages): reset terminal style after open_stream#444
Conversation
|
Fixed the CI regression: _safe_print and its suppress import were restored in craft_cli/printer.py. Re-ran the focused checks locally:
|
|
Hi! Just gently checking whether there’s anything I should adjust here. I rechecked this locally against the current upstream/main and re-ran the targeted checks:
The remaining CI failures still look unrelated to this PR’s diff: the failing Happy to rework this if useful, or to close it if this should not move forward. |
|
I rechecked the latest QA failure after commit The previous
The touched files for this PR remain focused on stream/message handling, and the targeted checks passed locally before the latest push. |
Summary
Reset terminal style after
open_stream()closes.If output written through
open_stream()includes ANSI control sequences that alter terminal styling, that styling could affect subsequent output because no reset sequence was emitted when the stream context manager exited.This change adds a terminal-style reset on stream close through the printer layer, and includes focused unit and integration coverage.
Testing
pytest -q tests/unit/test_messages_stream_cm.py -rs pytest -q tests/integration/test_messages_integration.py -k "third_party_output_brief_terminal or open_stream_no_text" -rs ruff check craft_cli/messages.py craft_cli/printer.py tests/unit/test_messages_stream_cm.py tests/integration/test_messages_integration.py