Skip to content

Commit e4b0a16

Browse files
committed
chore(cli): Only show compilation progress bar after a delay
Only show the progress bar after a delay to avoid flickering and annoying output for fast compilations.
1 parent 64079c3 commit e4b0a16

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

lib/cli/src/commands/run/runtime.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,22 @@ where
196196
let res = if quiet_mode {
197197
fut.await
198198
} else {
199-
let should_clear = bar.is_finished() || bar.is_hidden();
200-
show_compile_progress(bar, &hash, name.as_deref());
201-
let res = fut.await;
202-
if should_clear {
203-
bar.finish_and_clear();
199+
// Only show the progress bar after a delay to avoid flickering and
200+
// annoying output for fast compilations.
201+
let delay = tokio::time::sleep(Duration::from_secs(1));
202+
tokio::select! {
203+
_ = delay => {
204+
let should_clear = bar.is_finished() || bar.is_hidden();
205+
show_compile_progress(bar, &hash, name.as_deref());
206+
let res = fut.await;
207+
if should_clear {
208+
bar.finish_and_clear();
209+
}
210+
res
211+
}
212+
res = fut => {
213+
res
214+
}
204215
}
205216

206217
res

0 commit comments

Comments
 (0)