Skip to content

Commit c62682d

Browse files
fix(installations): correct faulty output when interleaving a installation with a download
1 parent 6ffea93 commit c62682d

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

src/dist/download.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ impl DownloadStatus {
272272
ProgressStyle::with_template("{msg:>12.bold} downloaded {total_bytes} in {elapsed}")
273273
.unwrap(),
274274
);
275-
self.progress.finish();
276275
}
277276

278277
pub(crate) fn failed(&self) {
@@ -288,6 +287,25 @@ impl DownloadStatus {
288287
self.progress
289288
.set_style(ProgressStyle::with_template("{msg:>12.bold} retrying download").unwrap());
290289
}
290+
291+
pub(crate) fn installing(&self) {
292+
self.progress.set_style(
293+
ProgressStyle::with_template(
294+
"{msg:>12.bold} downloaded {total_bytes} in {elapsed} installing now {spinner:.green}",
295+
)
296+
.unwrap()
297+
.tick_chars(r"|/-\ "),
298+
);
299+
self.progress.enable_steady_tick(Duration::from_millis(100));
300+
}
301+
302+
pub(crate) fn installed(&self) {
303+
self.progress.set_style(
304+
ProgressStyle::with_template("{msg:>12.bold} downloaded {total_bytes} and installed")
305+
.unwrap(),
306+
);
307+
self.progress.finish();
308+
}
291309
}
292310

293311
fn file_hash(path: &Path) -> Result<String> {

src/dist/manifestation.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -517,17 +517,7 @@ impl Manifestation {
517517
let short_pkg_name = component_bin.component.short_name_in_manifest();
518518
let short_name = component_bin.component.short_name(new_manifest);
519519

520-
match &component_bin.component.target {
521-
Some(t) if t != &self.target_triple => {
522-
info!("installing component {short_name}");
523-
}
524-
_ => {
525-
info!(
526-
"installing component {short_name} for target {}",
527-
self.target_triple
528-
)
529-
}
530-
}
520+
component_bin.status.installing();
531521

532522
let reader = utils::FileReaderWithProgress::new_file(&installer_file)?;
533523
let package = match component_bin.binary.compression {
@@ -542,7 +532,9 @@ impl Manifestation {
542532
return Err(RustupError::CorruptComponent(short_name).into());
543533
}
544534

545-
package.install(&self.installation, &pkg_name, Some(short_pkg_name), tx)
535+
let tx = package.install(&self.installation, &pkg_name, Some(short_pkg_name), tx);
536+
component_bin.status.installed();
537+
tx
546538
}
547539
}
548540

0 commit comments

Comments
 (0)