more verbose apply errors

This commit is contained in:
Mikaël Cluseau
2026-07-15 16:43:46 +02:00
parent 7fb751c2ef
commit fdf6085a35
2 changed files with 6 additions and 6 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
from mcluseau/rust:1.95.0 as build from mcluseau/rust:1.97.0 as build
workdir /app workdir /app
copy . . copy . .
@@ -10,6 +10,6 @@ run \
&& find target/release -maxdepth 1 -type f -executable -exec cp -v {} /dist/ + && find target/release -maxdepth 1 -type f -executable -exec cp -v {} /dist/ +
# ------------------------------------------------------------------------ # ------------------------------------------------------------------------
from alpine:3.23.4 from alpine:3.24.0
copy --from=build /dist/ /bin/ copy --from=build /dist/ /bin/
+4 -4
View File
@@ -1,4 +1,4 @@
use eyre::{Result, format_err}; use eyre::{Result, format_err, eyre};
use log::info; use log::info;
use std::path::Path; use std::path::Path;
use tokio::fs; use tokio::fs;
@@ -36,14 +36,14 @@ pub async fn file(file: &File, root: &str, dry_run: bool) -> Result<()> {
if dry_run { if dry_run {
info!("would create {} ({} bytes)", file.path, content.len()); info!("would create {} ({} bytes)", file.path, content.len());
} else { } else {
fs::write(path, &content).await?; fs::write(path, &content).await.map_err(|e| eyre!("write {}: {e}", path.display()))?;
} }
} }
K::Dir => { K::Dir => {
if dry_run { if dry_run {
info!("would create {} (directory)", file.path); info!("would create {} (directory)", file.path);
} else { } else {
fs::create_dir(path).await?; fs::create_dir(path).await.map_err(|e| eyre!("create dir {}: {e}", path.display()))?;
} }
} }
K::Symlink(tgt) => { K::Symlink(tgt) => {
@@ -51,7 +51,7 @@ pub async fn file(file: &File, root: &str, dry_run: bool) -> Result<()> {
info!("would create {} (symlink to {})", file.path, tgt); info!("would create {} (symlink to {})", file.path, tgt);
} else { } else {
let _ = fs::remove_file(path).await; // we're ln --force let _ = fs::remove_file(path).await; // we're ln --force
fs::symlink(tgt, path).await?; fs::symlink(tgt, path).await.map_err(|e| eyre!("symlink {} -> {tgt}: {e}", path.display()))?;
} }
} }
} }