Fix index out of bounds error in build script (#173)

This commit is contained in:
figsoda 2023-03-24 04:22:48 -04:00 committed by GitHub
parent 8b1852cffb
commit ec3f7004ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,7 +6,7 @@ fn main() {
.output()
.ok()
.and_then(|output| output.status.success().then(|| output))
.and_then(|output| String::from_utf8(output.stdout[..8].into()).ok())
.and_then(|output| String::from_utf8(output.stdout.get(..8)?.into()).ok())
.unwrap_or_else(|| "(unknown version)".into());
println!("cargo:rustc-env=TYPST_VERSION={version}");
}