File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change 6464- ` RUSTUP_TERM_PROGRESS_WHEN ` (defaults: ` auto ` ). Controls whether progress bars are shown or not.
6565 Set to ` always ` to always enable progress bars, and to ` never ` to disable them.
6666
67+ - ` RUSTUP_TERM_WIDTH ` (default: none). Allows to override the terminal width for progress bars.
68+
6769[ directive syntax ] : https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives
6870[ dc ] : https://docs.docker.com/storage/storagedriver/overlayfs-driver/#modifying-files-or-directories
6971[ override ] : overrides.md
Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ pub struct ColorableTerminal {
5757 inner : Arc < Mutex < TerminalInner > > ,
5858 is_a_tty : bool ,
5959 color_choice : ColorChoice ,
60+ width : Option < u16 > ,
6061}
6162
6263/// Internal state for ColorableTerminal
@@ -107,10 +108,16 @@ impl ColorableTerminal {
107108 #[ cfg( all( test, feature = "test" ) ) ]
108109 StreamSelector :: TestTtyWriter ( w) => TerminalInner :: TestWriter ( w, choice) ,
109110 } ;
111+ let width = process
112+ . var ( "RUSTUP_TERM_WIDTH" )
113+ . ok ( )
114+ . and_then ( |s| s. parse :: < u16 > ( ) . ok ( ) )
115+ . filter ( |& n| n > 0 ) ;
110116 ColorableTerminal {
111117 inner : Arc :: new ( Mutex :: new ( inner) ) ,
112118 is_a_tty,
113119 color_choice : choice,
120+ width,
114121 }
115122 }
116123
@@ -240,7 +247,10 @@ impl io::Write for ColorableTerminalLocked {
240247
241248impl TermLike for ColorableTerminal {
242249 fn width ( & self ) -> u16 {
243- Term :: stdout ( ) . size ( ) . 1
250+ match self . width {
251+ Some ( n) => n,
252+ None => Term :: stdout ( ) . size ( ) . 1 ,
253+ }
244254 }
245255
246256 fn move_cursor_up ( & self , n : usize ) -> io:: Result < ( ) > {
You can’t perform that action at this time.
0 commit comments