use std::error::Error; use std::process::Command; fn main() -> Result<(), Box> { let hash = Command::new("git") .arg("rev-parse") .arg("--short") .arg("HEAD") .output()? .stdout; println!("cargo:rustc-env=VERSION={}", std::str::from_utf8(&hash)?); Ok(()) }