Skip to content

Commit 2861bf1

Browse files
authored
Simplify emcc_version using -dumpversion flag (#2465)
This only returns the version number and no other information.
1 parent a9b3831 commit 2861bf1

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/build_context.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -1229,19 +1229,13 @@ fn emscripten_version() -> Result<String> {
12291229
}
12301230

12311231
fn emcc_version() -> Result<String> {
1232-
use regex::bytes::Regex;
12331232
use std::process::Command;
12341233

12351234
let emcc = Command::new("emcc")
1236-
.arg("--version")
1235+
.arg("-dumpversion")
12371236
.output()
12381237
.context("Failed to run emcc to get the version")?;
1239-
let pattern = Regex::new(r"^emcc .+? (\d+\.\d+\.\d+).*").unwrap();
1240-
let caps = pattern
1241-
.captures(&emcc.stdout)
1242-
.context("Failed to parse emcc version")?;
1243-
let version = caps.get(1).context("Failed to parse emcc version")?;
1244-
Ok(String::from_utf8(version.as_bytes().to_vec())?)
1238+
Ok(String::from_utf8(emcc.stdout)?.trim().into())
12451239
}
12461240

12471241
#[cfg(test)]

0 commit comments

Comments
 (0)