diff --git a/lib/src/blockdev.rs b/lib/src/blockdev.rs index 8631902fb..cd9c58b1f 100644 --- a/lib/src/blockdev.rs +++ b/lib/src/blockdev.rs @@ -98,6 +98,7 @@ pub(crate) fn list_dev(dev: &Utf8Path) -> Result { let mut devs: DevicesOutput = Command::new("lsblk") .args(["-J", "-b", "-O"]) .arg(dev) + .log_debug() .run_and_parse_json()?; for dev in devs.blockdevices.iter_mut() { dev.backfill_missing()?; diff --git a/utils/src/command.rs b/utils/src/command.rs index 3a360caae..7e57eab75 100644 --- a/utils/src/command.rs +++ b/utils/src/command.rs @@ -7,6 +7,7 @@ use anyhow::{Context, Result}; /// Helpers intended for [`std::process::Command`]. pub trait CommandRunExt { + fn log_debug(&mut self) -> &mut Self; fn run(&mut self) -> Result<()>; /// Execute the child process, parsing its stdout as JSON. fn run_and_parse_json(&mut self) -> Result; @@ -71,6 +72,11 @@ impl CommandRunExt for Command { self.status()?.check_status(stderr) } + fn log_debug(&mut self) -> &mut Self { + tracing::debug!("exec: {self:?}"); + self + } + fn run_and_parse_json(&mut self) -> Result { let mut stdout = tempfile::tempfile()?; self.stdout(stdout.try_clone()?);