Description
Problem you are trying to solve
Hello,
I'm currently working on some installation scripts and I'd like to install rust somewhat silently (or at least restrict the output to only errors).
I found the -q|--quiet
option in the script but it doesn't affect the script itself, only rustup
as far as I understand.
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -q -y
info: downloading installer
info: profile set to 'default'
info: default host triple is aarch64-unknown-linux-gnu
info: syncing channel updates for 'stable-aarch64-unknown-linux-gnu'
info: latest update on 2023-04-20, rust version 1.69.0 (84c898d65 2023-04-16)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
info: default toolchain set to 'stable-aarch64-unknown-linux-gnu'
stable-aarch64-unknown-linux-gnu installed - rustc 1.69.0 (84c898d65 2023-04-16)
Rust is installed now. Great!
To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).
To configure your current shell, run:
source "$HOME/.cargo/env"
All printf
and echo
lines in the script are postfixed with 1>&2
which redirect stdout
to stderr
even though the script has dedicated say
and err
function.
By doing so we are completely unable to only allow errors to be printed out and the -q|--quiet
doesn't do what its name suggests.
We are also unable to bypass this restriction by setting 1>/dev/null
ourselves.
Solution you'd like
I think the best solution would be apply the -q|--quiet
flag to the install script.
Another solution would be to let stdout
be what it is instead of redirecting it to stderr
(removing most of the 1>&2
inside the script).
At least I'd like to see some sort of warning/message in the --help
section of the script.
Notes
English isn't my primary language, I'm sorry if I made mistakes or if anything sounds bad.
### Tasks
- [ ] #3910
- [ ] https://github.com/rust-lang/rustup/issues/3900