summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@atos.net>2021-09-17 09:35:43 +0200
committerMatthias Beyer <matthias.beyer@atos.net>2021-09-17 09:35:43 +0200
commit72c20619999beb623f762a294c252d81c8f54081 (patch)
tree82726ed19ae15b1fece5ae8b5da3affcc2dd3fb7
parent812fe038c3fccf9d3b14d399dc6287828b60837b (diff)
parent93741fda7c94662b0cec15ea1d1906a81032e1f1 (diff)
Merge branch 'fix-release'
-rw-r--r--src/commands/release.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/commands/release.rs b/src/commands/release.rs
index 6f0232b..50d3918 100644
--- a/src/commands/release.rs
+++ b/src/commands/release.rs
@@ -14,6 +14,7 @@ use std::io::Write;
use std::path::PathBuf;
use anyhow::anyhow;
+use anyhow::Context;
use anyhow::Error;
use anyhow::Result;
use clap::ArgMatches;
@@ -165,9 +166,17 @@ async fn new_release(
}
}
+ if dest_path.exists() {
+ debug!("Removing {} before writing new file to this path", dest_path.display());
+ tokio::fs::remove_file(&dest_path)
+ .await
+ .with_context(|| anyhow!("Removing {} before writing new file to this path", dest_path.display()))?;
+ }
+
// else !dest_path.exists()
- tokio::fs::copy(art_path, &dest_path)
+ tokio::fs::copy(&art_path, &dest_path)
.await
+ .with_context(|| anyhow!("Copying {} to {}", art_path.display(), dest_path.display()))
.map_err(Error::from)
.map(|_| (art, dest_path))
}