Skip to content

Commit

Permalink
Merge pull request #5272 from cgwalters/errctx-finalize
Browse files Browse the repository at this point in the history
treefile: Add error context for finalize.d
  • Loading branch information
cgwalters authored Feb 3, 2025
2 parents c2b462e + 35731fb commit 368e806
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion rust/src/treefile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use cap_std::fs::MetadataExt as _;
use cap_std_ext::cap_std::fs::Dir;
use cap_std_ext::cmdext::CapStdExtCommandExt;
use cap_std_ext::prelude::CapStdExtDirExt;
use fn_error_context::context;
use nix::unistd::{Gid, Uid};
use once_cell::sync::Lazy;
use ostree_ext::{glib, ostree};
Expand Down Expand Up @@ -829,10 +830,14 @@ impl Treefile {
}

/// Execute all finalize.d scripts
#[context("Running finalize.d")]
pub(crate) fn exec_finalize_d(&self, rootfs: &Dir) -> Result<()> {
for (name, path) in self.externals.finalize_d.iter() {
println!("Executing: {name}");
Command::new(path).cwd_dir(rootfs.try_clone()?).run()?;
Command::new(path)
.cwd_dir(rootfs.try_clone()?)
.run()
.with_context(|| format!("Failed to execute {name}"))?;
}
Ok(())
}
Expand Down

0 comments on commit 368e806

Please sign in to comment.