Skip to content

Commit ede935a

Browse files
committed
Auto merge of #3498 - kleisauke:emscripten-git-compat, r=JohnTitor
Improve the version parser of Emscripten Some Emscripten versions come with `-git` attached, so split the version string also on the `-` char. See: rust-lang/rust#119250.
2 parents 6a203e9 + c424592 commit ede935a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

build.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,10 @@ fn emcc_version_code() -> Option<u64> {
274274
return None;
275275
}
276276
let version = stdout.unwrap();
277-
let mut pieces = version.trim().split('.');
277+
278+
// Some Emscripten versions come with `-git` attached, so split the
279+
// version string also on the `-` char.
280+
let mut pieces = version.trim().split(|c| c == '.' || c == '-');
278281

279282
let major = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);
280283
let minor = pieces.next().and_then(|x| x.parse().ok()).unwrap_or(0);

0 commit comments

Comments
 (0)