Skip to content

Return io errors from print_diff instead of panicking on broken pipe - #7159

Open
integral-830 wants to merge 1 commit into
rust-lang:mainfrom
integral-830:fix-broken-pipe-diff-output
Open

integral-830 wants to merge 1 commit into
rust-lang:mainfrom
integral-830:fix-broken-pipe-diff-output

Conversation

@integral-830

@integral-830 integral-830 commented Oct 4, 2026 •

Copy link
Copy Markdown
  • I did not use an LLM to create a change in this PR.
  • I used an LLM to create a change in this PR, and I have explained below how it was used.

Fixes #7158

OutputWriter::writeln unwrapped the results of writing to stdout, so a closed
pipe turned into a panic (reported on Windows, where BrokenPipe is returned
instead of the process being killed).

writeln and print_diff now return io::Result, and DiffEmitter propagates the
error with ?. The non-terminal path uses writeln! on stdout instead of
println!, which would panic on a failed write too.

I could only test on macOS, so I haven't tried this on Windows.

@rustbot rustbot added the S-waiting-on-review Status: awaiting review from the assignee but also interested parties. label Oct 4, 2026
@ytmimi ytmimi added the S-on-hold Status: PR/issue is on hold (due to bandwidth/prioritization/need discussions etc.). label Oct 4, 2026
@ytmimi

ytmimi commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Thank you for the PR.

Marking this as on hold until a minimal reproduction is provided that we can turn into a test case to verify the fix.

@ytmimi ytmimi added S-waiting-on-author Status: awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: awaiting review from the assignee but also interested parties. labels Oct 5, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-on-hold Status: PR/issue is on hold (due to bandwidth/prioritization/need discussions etc.). S-waiting-on-author Status: awaiting some action (such as code changes or more information) from the author.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

rustfmt panic / in unwrap() we trust / good first issue

3 participants