use std::process::{Command, exit}; fn main() -> Result<(), Box> { let buf_path = format!("{}/../../api", env!("CARGO_MANIFEST_DIR")); let status = Command::new("buf") .arg("generate") .current_dir(buf_path) .status()?; if !status.success() { exit(status.code().unwrap_or(-1)) } Ok(()) }