From 2861bf13b0859390afcc457a06d7e3e3ffc196cd Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Wed, 5 Feb 2025 13:43:51 +0100 Subject: [PATCH] Simplify emcc_version using -dumpversion flag (#2465) This only returns the version number and no other information. --- src/build_context.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/build_context.rs b/src/build_context.rs index cf73230a2..f09679a56 100644 --- a/src/build_context.rs +++ b/src/build_context.rs @@ -1229,19 +1229,13 @@ fn emscripten_version() -> Result { } fn emcc_version() -> Result { - use regex::bytes::Regex; use std::process::Command; let emcc = Command::new("emcc") - .arg("--version") + .arg("-dumpversion") .output() .context("Failed to run emcc to get the version")?; - let pattern = Regex::new(r"^emcc .+? (\d+\.\d+\.\d+).*").unwrap(); - let caps = pattern - .captures(&emcc.stdout) - .context("Failed to parse emcc version")?; - let version = caps.get(1).context("Failed to parse emcc version")?; - Ok(String::from_utf8(version.as_bytes().to_vec())?) + Ok(String::from_utf8(emcc.stdout)?.trim().into()) } #[cfg(test)]