move out code to a function
This commit is contained in:
parent
d09f88f7fa
commit
b9f0d80dc3
|
@ -17,6 +17,14 @@ fn extfilter(valid: String, x: Option<&OsStr>) -> bool {
|
||||||
ext == valid
|
ext == valid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn system(cmd: &str, args: &[&str]) -> String {
|
||||||
|
let out = Command::new(cmd)
|
||||||
|
.args(args)
|
||||||
|
.output()
|
||||||
|
.unwrap();
|
||||||
|
String::from_utf8(out.stdout).unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
||||||
println!("cargo:rerun-if-changed=static/assets");
|
println!("cargo:rerun-if-changed=static/assets");
|
||||||
|
@ -60,11 +68,7 @@ fn main() {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
});
|
});
|
||||||
|
|
||||||
let commit = Command::new("git")
|
let commit = system("git", &["rev-parse", "HEAD"]);
|
||||||
.args(&["rev-parse", "HEAD"])
|
|
||||||
.output()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let commit = String::from_utf8(commit.stdout).unwrap();
|
|
||||||
println!("cargo:rustc-env=COMMIT_HASH={commit}");
|
println!("cargo:rustc-env=COMMIT_HASH={commit}");
|
||||||
}
|
}
|
Loading…
Reference in New Issue