Skip to content

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

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

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
@ytmimi
ytmimi marked this pull request as draft October 6, 2026 06:24
@jieyouxu

jieyouxu commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Moderation note: temporarily closing this user's PRs due to rust-lang/rust#163860 (comment)

@jieyouxu jieyouxu closed this Oct 7, 2026
@rustbot rustbot removed the S-waiting-on-author Status: awaiting some action (such as code changes or more information) from the author. label Oct 7, 2026
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.).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

4 participants