Skip to content

Commit 6b3ada0

Browse files
committed
Use rustc --print host-tuple
1 parent 3e563b8 commit 6b3ada0

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

build_system/rustc_info.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,13 @@ use std::path::{Path, PathBuf};
22
use std::process::{Command, Stdio};
33

44
pub(crate) fn get_host_triple(rustc: &Path) -> String {
5-
let version_info =
6-
Command::new(rustc).stderr(Stdio::inherit()).args(&["-vV"]).output().unwrap().stdout;
7-
String::from_utf8(version_info)
8-
.unwrap()
9-
.lines()
10-
.to_owned()
11-
.find(|line| line.starts_with("host"))
12-
.unwrap()
13-
.split(":")
14-
.nth(1)
5+
let version_info = Command::new(rustc)
6+
.stderr(Stdio::inherit())
7+
.args(&["--print", "host-tuple"])
8+
.output()
159
.unwrap()
16-
.trim()
17-
.to_owned()
10+
.stdout;
11+
String::from_utf8(version_info).unwrap().trim().to_owned()
1812
}
1913

2014
pub(crate) fn get_toolchain_name() -> String {

0 commit comments

Comments
 (0)