We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
async-std
1 parent 0acd244 commit 4aed217Copy full SHA for 4aed217
1 file changed
crates/wit-deps/src/lib.rs
@@ -269,10 +269,19 @@ where
269
let path = path.as_ref();
270
let mut tar = async_tar::Builder::new(dst);
271
tar.mode(async_tar::HeaderMode::Deterministic);
272
- for name in read_wits(path).await?.try_collect::<BTreeSet<_>>().await? {
273
- tar.append_path_with_name(path.join(&name), Path::new("wit").join(name))
274
- .await?;
+ let res = async {
+ for name in read_wits(path).await?.try_collect::<BTreeSet<_>>().await? {
+ tar.append_path_with_name(path.join(&name), Path::new("wit").join(name))
275
+ .await?;
276
+ }
277
+ std::io::Result::Ok(())
278
279
+ .await;
280
+ if res.is_err() {
281
+ // Finalize the builder to avoid a panic on drop.
282
+ let _ = tar.finish().await;
283
}
284
+ res?;
285
tar.into_inner().await
286
287
0 commit comments