use std::process::Command; fn main() { let build = String::from_utf8_lossy( &Command::new("git") .args(&["rev-parse", "HEAD"]) .output() .unwrap() .stdout, ) .to_string(); println!( "cargo:rustc-env=DWVSH_BUILD={}", build.get(0..7).unwrap_or(&build) ); }