diff options
Diffstat (limited to 'mumd')
| -rw-r--r-- | mumd/build.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/mumd/build.rs b/mumd/build.rs index 45cfd4e..f09b1c4 100644 --- a/mumd/build.rs +++ b/mumd/build.rs @@ -5,21 +5,17 @@ fn main() { "{} {}-{}", env!("CARGO_PKG_NAME"), env!("CARGO_PKG_VERSION"), - commit_hash(), + commit_hash().unwrap_or_else(|| "???".to_string()), ); println!("cargo:rustc-env=VERSION={}", version); } -fn commit_hash() -> String { +fn commit_hash() -> Option<String> { let output = Command::new("git") .arg("show") .arg("--pretty=format:%h") // abbrev hash .current_dir(env!("CARGO_MANIFEST_DIR")) .output(); - if let Ok(output) = output { - String::from_utf8_lossy(&output.stdout).to_string() - } else { - String::from("???") - } + output.ok().map(|o| String::from_utf8_lossy(&o.stdout).to_string()) } |
