From c42459239c172ad30ce4b56fc88c9627af8c140f Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Sun, 24 Dec 2023 17:47:25 +0100 Subject: [PATCH] Improve the version parser of Emscripten Some Emscripten versions come with `-git` attached, so split the version string also on the `-` char. See: https://github.com/rust-lang/rust/issues/119250. --- build.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index ee99981881c04..6c684a5c1c838 100644 --- a/build.rs +++ b/build.rs @@ -274,7 +274,10 @@ fn emcc_version_code() -> Option { 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);