Skip to content

Commit 24813cc

Browse files
fix(installations): correct faulty output when interleaving a installation with a download
1 parent baba333 commit 24813cc

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
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: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -805,17 +805,7 @@ impl<'a> ComponentBinary<'a> {
805805
let short_pkg_name = component.short_name_in_manifest();
806806
let short_name = component.short_name(new_manifest);
807807

808-
match &component.target {
809-
Some(t) if t != &manifestation.target_triple => {
810-
info!("installing component {short_name}");
811-
}
812-
_ => {
813-
info!(
814-
"installing component {short_name} for target {}",
815-
manifestation.target_triple
816-
)
817-
}
818-
}
808+
self.status.installing();
819809

820810
let reader = utils::FileReaderWithProgress::new_file(&installer_file)?;
821811
let package = match self.binary.compression {
@@ -830,11 +820,13 @@ impl<'a> ComponentBinary<'a> {
830820
return Err(RustupError::CorruptComponent(short_name).into());
831821
}
832822

833-
package.install(
823+
let tx = package.install(
834824
&manifestation.installation,
835825
&pkg_name,
836826
Some(short_pkg_name),
837827
tx,
838-
)
828+
);
829+
self.status.installed();
830+
tx
839831
}
840832
}

0 commit comments

Comments
 (0)