Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)" when writing to a pipe #8

Open
rpdelaney opened this issue Jul 22, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@rpdelaney
Copy link

Description

I've worked out how to use fsrx to speed up my reading of manpages. However, intermittently, I get an error when closing the pager.

$ echo "$MANPAGER"
col -bx | fsrx | ifne less -R
$ RUST_BACKTRACE="full" man man
thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', library/std/src/io/stdio.rs:1016:9
stack backtrace:
   0:        0x10032b60c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha610dc96df5533b5
   1:        0x10033dab8 - core::fmt::write::h85a0222d7173f527
   2:        0x100318834 - std::io::Write::write_fmt::h1e81e1aae1f60926
   3:        0x100320564 - std::panicking::default_hook::{{closure}}::hafcdd34daa6aee47
   4:        0x100320228 - std::panicking::default_hook::hbdef0c99978ce86d
   5:        0x100320a78 - std::panicking::rust_panic_with_hook::he857adbde651a96b
   6:        0x10032bbcc - std::panicking::begin_panic_handler::{{closure}}::h78d4b95de3b3c015
   7:        0x10032b720 - std::sys_common::backtrace::__rust_end_short_backtrace::h948efd9d51b5e877
   8:        0x100320678 - _rust_begin_unwind
   9:        0x10034a1d0 - core::panicking::panic_fmt::h4c391ad4ab25a9e0
  10:        0x100312004 - std::io::stdio::_print::hff0a1d2b7e1a5800
  11:        0x10026ab8c - fsrx::main::h55fca34d33cf796a
  12:        0x10026e77c - std::sys_common::backtrace::__rust_begin_short_backtrace::h389c28ebd38b79bf
  13:        0x10026e79c - std::rt::lang_start::{{closure}}::hcd3d64d5e1b5843b
  14:        0x100318288 - std::rt::lang_start_internal::h0a14a326db0de5c9
  15:        0x10026b72c - _main
$

Expected behavior

Everything works as desired except for the error at the end.

Environment

  • OS: macOS-12.4
  • Terminal Emulator: kitty
  • Font: Iosevka Custom
  • fsrx version: 1.0.2
@rpdelaney rpdelaney added the bug Something isn't working label Jul 22, 2022
@TheBestJohn
Copy link

failed printing to stdout: Broken pipe (os error 32) speaks to a println!() panic. Rust's println! macro ignores SIGPIPE as it is obviously doing here and continues to try to write to stout after SIGPIPE was trying to communicate to it that it's closed. Moving to writeln!(stdout, "{}", style_line(...)) should fix this error. Will add PR when I have some time shortly.

Ref: Stack OF issue sharing the same problem
rust-lang open SIGPIPE issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants