Skip to content

Commit 9e03fc4

Browse files
fix(installations): correct faulty output when interleaving a installation with a download
1 parent 306b659 commit 9e03fc4

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/cli/download_tracker.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ impl DownloadTracker {
7373
self.retrying_download(url);
7474
true
7575
}
76+
Notification::Install(In::InstallingComponent(component, _, _)) => {
77+
self.installing_component(component);
78+
true
79+
}
7680
_ => false,
7781
}
7882
}
@@ -151,4 +155,24 @@ impl DownloadTracker {
151155
*retry_time = Some(Instant::now());
152156
pb.set_style(ProgressStyle::with_template("{msg:>12.bold} retrying download").unwrap());
153157
}
158+
159+
/// Notifies that the downloaded component is being installed.
160+
pub(crate) fn installing_component(&mut self, component: &str) {
161+
let key = self
162+
.file_progress_bars
163+
.keys()
164+
.find(|comp| comp.contains(component))
165+
.cloned();
166+
if let Some(key) = key
167+
&& let Some((pb, _)) = self.file_progress_bars.get(&key)
168+
{
169+
pb.set_style(
170+
ProgressStyle::with_template(
171+
"{msg:>12.bold} downloaded {total_bytes} in {elapsed} installing now...",
172+
)
173+
.unwrap(),
174+
);
175+
pb.finish();
176+
}
177+
}
154178
}

0 commit comments

Comments
 (0)