We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 17c5869 commit 15c75feCopy full SHA for 15c75fe
build.rs
@@ -43,15 +43,16 @@ fn commit_hash() -> Option<String> {
43
.args(["rev-parse", "HEAD"])
44
.output()
45
.ok()?;
46
- let mut stdout = String::from_utf8(output.stdout).ok()?;
+ let mut stdout = output.status.success().then_some(output.stdout)?;
47
stdout.truncate(10);
48
- Some(stdout)
+ String::from_utf8(stdout).ok()
49
}
50
51
fn commit_date() -> Option<String> {
52
- Command::new("git")
+ let output = Command::new("git")
53
.args(["log", "-1", "--date=short", "--pretty=format:%cd"])
54
55
- .ok()
56
- .and_then(|r| String::from_utf8(r.stdout).ok())
+ .ok()?;
+ let stdout = output.status.success().then_some(output.stdout)?;
57
58
0 commit comments