rust-lang / rustup

The Rust toolchain installer
https://rust-lang.github.io/rustup/
Apache License 2.0
6.03k stars 877 forks source link

error messages often written to stdout rather than stderr #3303

Open mcandre opened 1 year ago

mcandre commented 1 year ago

Problem

When rustup emits error messages, these sometimes appear on the stdout stream, instead of the stderr stream. This makes it harder for aggregate CLI commands to distinguish between logs (such as lists of target triples) vs. error messages.

Steps

  1. Run rustup target list foo with and without redirecting stdout to a null stream.

Possible Solution(s)

Ensure that all error messages write to the stderr stream, rather than stdout.

Notes

No response

Rustup version

rustup 1.25.2 (17db695f1 2023-02-01)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.68.2 (9eb3afe9e 2023-03-27)`

Installed toolchains

Default host: aarch64-apple-darwin
rustup home:  /Users/andrew/.asdf/installs/rust/1.68.2

installed toolchains
--------------------

1.68.2-aarch64-apple-darwin (default)
1.68.2-x86_64-unknown-linux-gnu

active toolchain
----------------

1.68.2-aarch64-apple-darwin (default)
rustc 1.68.2 (9eb3afe9e 2023-03-27)
rami3l commented 1 month ago

@mcandre Thanks for filing this issue! Do you happen to remember what exactly did you not expect to appear in stdout?

Your observations are quite important for #3803 as I'm planning to move the whole logging system to tracing (it currently targets stderr exclusively) and I do want to get more insights into the original implementation and its issues. Thanks!