Skip to content

rustup panics when piping to grep -q #1621

Closed
@NickeZ

Description

@NickeZ
Contributor

I noticed that rustup panics in the case below.

 RUST_BACKTRACE=1 rustup show | grep -q ^nightly
thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', libstd/io/stdio.rs:700:9
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::panicking::default_hook::{{closure}}
             at libstd/sys_common/backtrace.rs:71
   2: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:227
             at libstd/panicking.rs:476
   3: std::panicking::continue_panic_fmt
             at libstd/panicking.rs:390
   4: std::panicking::begin_panic_fmt
             at libstd/panicking.rs:345
   5: std::io::stdio::_print
             at libstd/io/stdio.rs:700
             at libstd/io/stdio.rs:709
   6: rustup_init::rustup_mode::main
   7: rustup_init::run_rustup
   8: rustup_init::main
   9: std::rt::lang_start::{{closure}}
  10: main
  11: __libc_start_main
  12: <unknown>

Activity

NickeZ

NickeZ commented on Jan 22, 2019

@NickeZ
ContributorAuthor

I guess grep exits too fast for rustups liking?

       -q, --quiet, --silent
              Quiet; do not write anything to standard output.  Exit immediately with zero status if any match is found, even if an error was detected.  Also see the -s
              or --no-messages option.

NickeZ

NickeZ commented on Jan 22, 2019

@NickeZ
ContributorAuthor

Btw, I have two nightlies installed:

$ rustup show | grep ^nightly
7:nightly-2018-10-05-x86_64-unknown-linux-gnu
8:nightly-x86_64-unknown-linux-gnu
NickeZ

NickeZ commented on Jan 30, 2019

@NickeZ
ContributorAuthor

Even easier reproducer:

rustup show | head -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @NickeZ

        Issue actions

          rustup panics when piping to `grep -q` · Issue #1621 · rust-lang/rustup