Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): Fixed bug where the progress bar did not clear #16401

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cli/proc_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ impl ProcState {
dynamic_permissions: Permissions,
reload_on_watch: bool,
) -> Result<(), AnyError> {
let _pb_clear_guard = self.progress_bar.clear_guard();
let roots = roots
.into_iter()
.map(|s| (s, ModuleKind::Esm))
Expand Down Expand Up @@ -412,7 +413,7 @@ impl ProcState {
self.prepare_node_std_graph().await?;
}

self.progress_bar.clear();
dsherret marked this conversation as resolved.
Show resolved Hide resolved
k-nasa marked this conversation as resolved.
Show resolved Hide resolved
drop(_pb_clear_guard);

// type check if necessary
if self.options.type_check_mode() != TypeCheckMode::None {
Expand Down
14 changes: 14 additions & 0 deletions cli/progress_bar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,18 @@ impl ProgressBar {
inner.pb = None;
}
}

pub fn clear_guard(&self) -> ClearGuard {
ClearGuard { pb: self.clone() }
}
}

pub struct ClearGuard {
pb: ProgressBar,
}

impl Drop for ClearGuard {
fn drop(&mut self) {
self.pb.clear();
}
}