Be more informative about missing binaries

This commit is contained in:
Roey Darwish Dror 2021-12-07 21:08:51 +00:00 committed by Philip Mueller
parent 21e11151c8
commit 60438bac5c

View File

@ -2,6 +2,7 @@ mod chroot;
mod mount;
mod qemu;
use anyhow::Context;
pub use chroot::chroot;
pub use mount::mount;
pub use qemu::qemu;
@ -17,7 +18,9 @@ pub struct Tool {
impl Tool {
pub fn find(name: &'static str) -> anyhow::Result<Self> {
Ok(Self { exec: which(name)? })
Ok(Self {
exec: which(name).context(format!("Cannot find {}", name))?,
})
}
pub fn execute(&self) -> Command {