From 3c243011932af5a8e0885561f90ce12b35770538 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Tue, 7 Nov 2023 10:58:17 -0800 Subject: [PATCH] Avoid removing progress bars (#362) This was dumb of me. We pass out indexes when adding progress bars, but were then removing entries on completion, so any outstanding indexes were now _invalid_. We just shouldn't remove them. The `MultiProgress` retains a reference anyway, IIUC. Closes https://github.com/astral-sh/puffin/issues/360. --- crates/puffin-cli/src/commands/reporters.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/puffin-cli/src/commands/reporters.rs b/crates/puffin-cli/src/commands/reporters.rs index 8e195293d..376338653 100644 --- a/crates/puffin-cli/src/commands/reporters.rs +++ b/crates/puffin-cli/src/commands/reporters.rs @@ -266,8 +266,8 @@ impl puffin_resolver::ResolverReporter for ResolverReporter { } fn on_build_complete(&self, distribution: &RemoteDistributionRef<'_>, index: usize) { - let mut bars = self.bars.lock().unwrap(); - let progress = bars.remove(index); + let bars = self.bars.lock().unwrap(); + let progress = &bars[index]; progress.finish_with_message(format!( "{} {}", "Built".bold().green(), @@ -296,8 +296,8 @@ impl puffin_resolver::ResolverReporter for ResolverReporter { } fn on_checkout_complete(&self, url: &Url, rev: &str, index: usize) { - let mut bars = self.bars.lock().unwrap(); - let progress = bars.remove(index); + let bars = self.bars.lock().unwrap(); + let progress = &bars[index]; progress.finish_with_message(format!( "{} {} ({})", "Updated".bold().green(),