process.rs (392B)
1 use std::ffi::OsString; 2 3 use miette::{Context, IntoDiagnostic}; 4 5 pub(crate) fn which(name: &'static str, desc: &str) -> miette::Result<OsString> { 6 let found = ::which::which(name) 7 .into_diagnostic() 8 .wrap_err_with(|| format!("failed to find `{name}` executable"))?; 9 log::debug!("using {desc} from {}", found.display()); 10 Ok(found.file_name().unwrap().to_owned()) 11 }