use crate::process::ProcessSpec;
use crate::tool::Tool;
pub(super) fn host_target_triple() -> String {
let spec = ProcessSpec::new(Tool::Rustc.executable(), ".");
let output = match crate::process::run_capture(&spec.arg("-vV")) {
Ok(bytes) => bytes,
Err(_) => {
return format!("{}-unknown", std::env::consts::ARCH);
}
};
let text = String::from_utf8_lossy(&output);
for line in text.lines() {
if let Some(rest) = line.strip_prefix("host: ") {
return rest.trim().to_owned();
}
}
format!("{}-unknown", std::env::consts::ARCH)
}