Skip to content
Permalink
Browse files

build: don't panic on git failure

This fixes issue #19, which shouldn't break the build if git fails or is
otherwise invalid.

Signed-off-by: Sean Cross <sean@xobs.io>
  • Loading branch information...
xobs committed Mar 1, 2019
1 parent 5a70f2c commit 7c99b4730317f453aaca0d3ee0581e4ba6d26e60
Showing with 11 additions and 7 deletions.
  1. +11 −7 build.rs
@@ -16,13 +16,17 @@ fn set_env_with_name(name: &str) {
.output()
{
Ok(cmd) => {
assert!(cmd.status.success());
match std::str::from_utf8(&cmd.stdout[..]) {
Ok(v) => v.trim().to_owned(),
Err(_) => match env::var(name) {
Ok(val) => val.trim().to_owned(),
Err(_) => "invalid-git-version".to_owned(),
}
if cmd.status.success() {
match std::str::from_utf8(&cmd.stdout[..]) {
Ok(v) => v.trim().to_owned(),
Err(_) => match env::var(name) {
Ok(val) => val.trim().to_owned(),
Err(_) => "invalid-git-version".to_owned(),
}
}
}
else {
"no-git-version".to_owned()
}
}
Err(_) => match env::var(name) {

0 comments on commit 7c99b47

Please sign in to comment.
You can’t perform that action at this time.