@@ -10,8 +10,8 @@ pub const STANDARD_RANGE: ProgressRange = 2..=2;
10
10
/// will just be initialized.
11
11
#[ cfg( feature = "env_logger" ) ]
12
12
#[ allow( unused) ] // Squelch warning because it's used in porcelain as well and we can't know that at compile time
13
- pub fn init_env_logger ( verbose : bool ) {
14
- if verbose {
13
+ pub fn init_env_logger ( ) {
14
+ if cfg ! ( feature = "small" ) {
15
15
env_logger:: Builder :: from_env ( env_logger:: Env :: default ( ) . default_filter_or ( "info" ) )
16
16
. format_module_path ( false )
17
17
. init ( ) ;
@@ -21,7 +21,7 @@ pub fn init_env_logger(verbose: bool) {
21
21
}
22
22
23
23
#[ cfg( feature = "prodash-render-line" ) ]
24
- pub fn progress_tree ( ) -> prodash:: Tree {
24
+ pub fn progress_tree ( ) -> std :: sync :: Arc < prodash:: Tree > {
25
25
prodash:: TreeOptions {
26
26
message_buffer_capacity : 200 ,
27
27
..Default :: default ( )
@@ -74,7 +74,7 @@ pub mod pretty {
74
74
+ std:: panic:: UnwindSafe
75
75
+ ' static ,
76
76
) -> Result < T > {
77
- crate :: shared:: init_env_logger ( false ) ;
77
+ crate :: shared:: init_env_logger ( ) ;
78
78
79
79
match ( verbose, progress) {
80
80
( false , false ) => {
@@ -91,12 +91,10 @@ pub mod pretty {
91
91
{
92
92
let stdout = stdout ( ) ;
93
93
let mut stdout_lock = stdout. lock ( ) ;
94
- let stderr = stderr ( ) ;
95
- let mut stderr_lock = stderr. lock ( ) ;
96
94
run (
97
95
progress:: DoOrDiscard :: from ( Some ( sub_progress) ) ,
98
96
& mut stdout_lock,
99
- & mut stderr_lock ,
97
+ & mut stderr ( ) ,
100
98
)
101
99
}
102
100
#[ cfg( feature = "prodash-render-line" ) ]
@@ -108,7 +106,8 @@ pub mod pretty {
108
106
}
109
107
use crate :: shared:: { self , STANDARD_RANGE } ;
110
108
let ( tx, rx) = std:: sync:: mpsc:: sync_channel :: < Event < T > > ( 1 ) ;
111
- let ui_handle = shared:: setup_line_renderer_range ( progress, range. into ( ) . unwrap_or ( STANDARD_RANGE ) ) ;
109
+ let ui_handle =
110
+ shared:: setup_line_renderer_range ( & progress, range. into ( ) . unwrap_or ( STANDARD_RANGE ) ) ;
112
111
std:: thread:: spawn ( {
113
112
let tx = tx. clone ( ) ;
114
113
move || loop {
@@ -119,8 +118,6 @@ pub mod pretty {
119
118
}
120
119
}
121
120
} ) ;
122
- // LIMITATION: This will hang if the thread panics as no message is send and the renderer thread will wait forever.
123
- // `catch_unwind` can't be used as a parking lot mutex is not unwind safe, coming from prodash.
124
121
let join_handle = std:: thread:: spawn ( move || {
125
122
let mut out = Vec :: < u8 > :: new ( ) ;
126
123
let res = std:: panic:: catch_unwind ( std:: panic:: AssertUnwindSafe ( || {
@@ -171,11 +168,11 @@ pub mod pretty {
171
168
let sub_progress = progress. add_child ( name) ;
172
169
let render_tui = prodash:: render:: tui (
173
170
stdout ( ) ,
174
- progress,
171
+ std :: sync :: Arc :: downgrade ( & progress) ,
175
172
prodash:: render:: tui:: Options {
176
173
title : "gitoxide" . into ( ) ,
177
174
frames_per_second : shared:: DEFAULT_FRAME_RATE ,
178
- stop_if_empty_progress : !progress_keep_open,
175
+ stop_if_progress_missing : !progress_keep_open,
179
176
throughput : true ,
180
177
..Default :: default ( )
181
178
} ,
@@ -219,12 +216,12 @@ pub mod pretty {
219
216
#[ allow( unused) ]
220
217
#[ cfg( feature = "prodash-render-line" ) ]
221
218
pub fn setup_line_renderer_range (
222
- progress : prodash:: Tree ,
219
+ progress : & std :: sync :: Arc < prodash:: Tree > ,
223
220
levels : std:: ops:: RangeInclusive < prodash:: progress:: key:: Level > ,
224
221
) -> prodash:: render:: line:: JoinHandle {
225
222
prodash:: render:: line (
226
223
std:: io:: stderr ( ) ,
227
- progress,
224
+ std :: sync :: Arc :: downgrade ( progress) ,
228
225
prodash:: render:: line:: Options {
229
226
level_filter : Some ( levels) ,
230
227
frames_per_second : DEFAULT_FRAME_RATE ,
0 commit comments