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.
This commit is contained in:
Charlie Marsh 2023-11-07 10:58:17 -08:00 committed by GitHub
parent 7abe141d3f
commit 3c24301193
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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(),