Skip to content

Commit c1d1bbc

Browse files
fix(installations): correct faulty output when interleaving a installation with a download
1 parent 2ad06c8 commit c1d1bbc

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
@@ -68,6 +68,10 @@ impl DownloadTracker {
6868
self.retrying_download(url);
6969
true
7070
}
71+
Notification::Install(In::InstallingComponent(component, _, _)) => {
72+
self.installing_component(component);
73+
true
74+
}
7175
_ => false,
7276
}
7377
}
@@ -146,4 +150,24 @@ impl DownloadTracker {
146150
*retry_time = Some(Instant::now());
147151
pb.set_style(ProgressStyle::with_template("{msg:>12.bold} retrying download").unwrap());
148152
}
153+
154+
/// Notifies that the downloaded component is being installed.
155+
pub(crate) fn installing_component(&mut self, component: &str) {
156+
let key = self
157+
.file_progress_bars
158+
.keys()
159+
.find(|comp| comp.contains(component))
160+
.cloned();
161+
if let Some(key) = key
162+
&& let Some((pb, _)) = self.file_progress_bars.get(&key)
163+
{
164+
pb.set_style(
165+
ProgressStyle::with_template(
166+
"{msg:>12.bold} downloaded {total_bytes} in {elapsed} installing now...",
167+
)
168+
.unwrap(),
169+
);
170+
pb.finish();
171+
}
172+
}
149173
}

0 commit comments

Comments
 (0)