Non-git fallback

This commit is contained in:
Matthew Esposito 2023-01-04 16:31:27 -05:00
parent 1cc3104498
commit 05c3cca365
1 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
use std::process::Command;
fn main() {
let output = Command::new("git").args(["rev-parse", "HEAD"]).output().unwrap();
let git_hash = String::from_utf8(output.stdout).unwrap();
let output = String::from_utf8(Command::new("git").args(["rev-parse", "HEAD"]).output().unwrap().stdout).unwrap_or_default();
let git_hash = if output == String::default() { "dev".into() } else { output };
println!("cargo:rustc-env=GIT_HASH={git_hash}");
}