use std::process::Command; pub fn call_exec(exec_name: &str, exec_path: &str, args: Vec<&str>) -> Result, String> { let output = Command::new(exec_path) .args(&args) .output() .expect(&format!("calling {} failed smh", exec_name)); match output.status.success() { true => Ok(output.stdout), false => Err(match output.status.code() { Some(code) => format!("{} exited with {:}: {:?}", exec_name, code, output.stdout), None => format!("{} exited by signal", exec_name), }), } }