Delete target directory before running odrefresh
This allows it to re-create the directory and files when it runs.
Bug: 210460516
Test: composd_cmd async-odrefresh
Change-Id: I1e5a100f0d68d0266c9af9d681e243dd5bdb0556
diff --git a/compos/src/artifact_signer.rs b/compos/src/artifact_signer.rs
index ce32d6b..a4b47d6 100644
--- a/compos/src/artifact_signer.rs
+++ b/compos/src/artifact_signer.rs
@@ -70,13 +70,15 @@
let signature = signer.sign(&bytes)?;
- let mut file = File::create(info_path)?;
+ let mut file =
+ File::create(info_path).with_context(|| format!("Creating {}", info_path.display()))?;
file.write_all(&bytes)?;
let mut signature_name = info_path.file_name().unwrap().to_owned();
signature_name.push(SIGNATURE_EXTENSION);
let signature_path = info_path.with_file_name(&signature_name);
- let mut signature_file = File::create(&signature_path)?;
+ let mut signature_file = File::create(&signature_path)
+ .with_context(|| format!("Creating {}", signature_path.display()))?;
signature_file.write_all(&signature)?;
Ok(())