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 8eed47d commit f3d4131Copy full SHA for f3d4131
build.rs
@@ -1,17 +1,9 @@
1
-use std::process::Command;
2
-
3
-fn git_hash() -> String {
4
- let output = Command::new("cat")
5
- .args(&[".git/refs/heads/next"])
6
- .output()
7
- .unwrap();
8
- String::from_utf8_lossy(&output.stdout).into()
9
-}
+use std::fs::read_to_string;
10
11
fn main() {
12
let git_hash = option_env!("TRAVIS_COMMIT")
13
.map(|s| s.into())
14
- .unwrap_or_else(|| git_hash());
+ .unwrap_or_else(|| read_to_string(".git/refs/heads/next").unwrap_or_default());
15
16
println!("cargo:rustc-env=GIT_HASH={}", git_hash);
17
}
0 commit comments