-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.O-linuxOperating system: LinuxOperating system: LinuxO-macosOperating system: macOSOperating system: macOST-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
$ cat yes.rs
fn main() { loop { println!("y"); } }
$ rustc yes.rs && ./yes | head -n1
y
thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', src/libstd/io/stdio.rs:692:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.
$ yes | head -n1
y
This was originally filed here but @sfackler determined the cause:
This is due to
println!
panicking on errors:.Line 671 in f1ea23e
fn print_to<T>(args: fmt::Arguments, C-based programs typically just get killed off with a SIGPIPE, but Rust ignores that signal.
Note that to see the backtrace, the data being piped has to be large enough to overflow the kernel pipe buffer.
ad-si, jimis, YodaEmbedding, clux, scurest and 33 more
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.O-linuxOperating system: LinuxOperating system: LinuxO-macosOperating system: macOSOperating system: macOST-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.