@@ -805,11 +805,15 @@ async fn check_updates(cfg: &Cfg<'_>, opts: CheckOpts) -> Result<utils::ExitCode
805805 // Ensure that `.buffered()` is never called with 0 as this will cause a hang.
806806 // See: https://github.com/rust-lang/futures-rs/pull/1194#discussion_r209501774
807807 if num_channels > 0 {
808- let multi_progress_bars = if is_a_tty {
809- MultiProgress :: with_draw_target ( ProgressDrawTarget :: term_like ( Box :: new ( t) ) )
810- } else {
811- MultiProgress :: with_draw_target ( ProgressDrawTarget :: hidden ( ) )
812- } ;
808+ let multi_progress_bars =
809+ MultiProgress :: with_draw_target ( match cfg. process . var ( "RUSTUP_TERM_PROGRESS_WHEN" ) {
810+ Ok ( s) if s. eq_ignore_ascii_case ( "always" ) => {
811+ ProgressDrawTarget :: term_like ( Box :: new ( t) )
812+ }
813+ Ok ( s) if s. eq_ignore_ascii_case ( "never" ) => ProgressDrawTarget :: hidden ( ) ,
814+ _ if is_a_tty => ProgressDrawTarget :: term_like ( Box :: new ( t) ) ,
815+ _ => ProgressDrawTarget :: hidden ( ) ,
816+ } ) ;
813817 let channels = tokio_stream:: iter ( channels. into_iter ( ) ) . map ( |( name, distributable) | {
814818 let pb = multi_progress_bars. add ( ProgressBar :: new ( 1 ) ) ;
815819 pb. set_style (
@@ -869,7 +873,7 @@ async fn check_updates(cfg: &Cfg<'_>, opts: CheckOpts) -> Result<utils::ExitCode
869873 // If we are running in a TTY, we can use `buffer_unordered` since
870874 // displaying the output in the correct order is already handled by
871875 // `indicatif`.
872- let channels = if is_a_tty {
876+ let channels = if !multi_progress_bars . is_hidden ( ) {
873877 channels
874878 . buffer_unordered ( num_channels)
875879 . collect :: < Vec < _ > > ( )
@@ -884,7 +888,7 @@ async fn check_updates(cfg: &Cfg<'_>, opts: CheckOpts) -> Result<utils::ExitCode
884888 if update_a {
885889 update_available = true ;
886890 }
887- if !is_a_tty {
891+ if multi_progress_bars . is_hidden ( ) {
888892 writeln ! ( t. lock( ) , "{message}" ) ?;
889893 }
890894 }
0 commit comments