summaryrefslogtreecommitdiffstats
path: root/src/commands/source/download.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/source/download.rs')
-rw-r--r--src/commands/source/download.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/commands/source/download.rs b/src/commands/source/download.rs
index 67a0cad..b73a074 100644
--- a/src/commands/source/download.rs
+++ b/src/commands/source/download.rs
@@ -140,11 +140,16 @@ async fn perform_download(source: &SourceEntry, progress: Arc<Mutex<ProgressWrap
let mut stream = response.bytes_stream();
while let Some(bytes) = stream.next().await {
let bytes = bytes?;
- file.write_all(bytes.as_ref()).await?;
- progress.lock()
- .await
- .add_bytes(bytes.len())
- .await
+ tokio::try_join!(
+ file.write_all(bytes.as_ref()),
+ async {
+ progress.lock()
+ .await
+ .add_bytes(bytes.len())
+ .await;
+ Ok(())
+ }
+ )?;
}
file.flush()