Skip to content

Commit 7e45922

Browse files
rbtcollinsdjc
authored andcommitted
Make DownloadCfg::download_hash async
1 parent 8b987c6 commit 7e45922

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/dist/download.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,14 @@ impl<'a> DownloadCfg<'a> {
126126
Ok(())
127127
}
128128

129-
fn download_hash(&self, url: &str) -> Result<String> {
129+
async fn download_hash(&self, url: &str) -> Result<String> {
130130
let hash_url = utils::parse_url(&(url.to_owned() + ".sha256"))?;
131131
let hash_file = self.tmp_cx.new_file()?;
132132

133-
utils::run_future(utils::download_file(&hash_url, &hash_file, None, &|n| {
133+
utils::download_file(&hash_url, &hash_file, None, &|n| {
134134
(self.notify_handler)(n.into())
135-
}))?;
135+
})
136+
.await?;
136137

137138
utils::read_file("hash", &hash_file).map(|s| s[0..64].to_owned())
138139
}
@@ -148,7 +149,7 @@ impl<'a> DownloadCfg<'a> {
148149
update_hash: Option<&Path>,
149150
ext: &str,
150151
) -> Result<Option<(temp::File<'a>, String)>> {
151-
let hash = self.download_hash(url_str)?;
152+
let hash = utils::run_future(self.download_hash(url_str))?;
152153
let partial_hash: String = hash.chars().take(UPDATE_HASH_LEN).collect();
153154

154155
if let Some(hash_file) = update_hash {

0 commit comments

Comments
 (0)