Skip to content

Commit

Permalink
Auto merge of #3498 - kleisauke:emscripten-git-compat, r=JohnTitor
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Dec 30, 2023
2 parents 6a203e9 + c424592 commit ede935a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion build.rs
Expand Up @@ -274,7 +274,10 @@ fn emcc_version_code() -> Option<u64> {
return None;
}
let version = stdout.unwrap();
let mut pieces = version.trim().split('.');

// Some Emscripten versions come with `-git` attached, so split the
// version string also on the `-` char.
let mut pieces = version.trim().split(|c| c == '.' || c == '-');

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

0 comments on commit ede935a

Please sign in to comment.