Skip to content

Commit

Permalink
Fix build when git is not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
9ary committed May 4, 2023
1 parent 3d38884 commit ba5c70b
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
use std::process::Command;

fn main() {
let git_version = Command::new("git")
.arg("describe")
.arg("--tags")
.output()
.expect("Failed to get git description");
if git_version.status.success() {
let git_version =
String::from_utf8(git_version.stdout).expect("Failed to decode git description");
print!("cargo:rustc-env=GIT_VERSION={}", git_version);
let git_version = Command::new("git").arg("describe").arg("--tags").output();
if let Ok(git_version) = git_version {
if git_version.status.success() {
let git_version =
String::from_utf8(git_version.stdout).expect("Failed to decode git description");
print!("cargo:rustc-env=GIT_VERSION={}", git_version);
}
}
}

0 comments on commit ba5c70b

Please sign in to comment.