From 35731fb424f210f2ab0023c65ee94b684f3645b9 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 3 Feb 2025 14:59:07 -0500 Subject: [PATCH] treefile: Add error context for finalize.d We were missing this. Signed-off-by: Colin Walters --- rust/src/treefile.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/rust/src/treefile.rs b/rust/src/treefile.rs index 352e3c74d9..a2908b8ebf 100644 --- a/rust/src/treefile.rs +++ b/rust/src/treefile.rs @@ -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}; @@ -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(()) }