use std::panic;
use crate::command::Command;
use crate::env_var;
use crate::util::handle_failed_output;
#[must_use]
pub fn target() -> String {
env_var("TARGET")
}
#[must_use]
pub fn is_windows() -> bool {
target().contains("windows")
}
#[must_use]
pub fn is_msvc() -> bool {
target().contains("msvc")
}
#[must_use]
pub fn is_darwin() -> bool {
target().contains("darwin")
}
#[must_use]
pub fn llvm_components_contain(component: &str) -> bool {
env_var("LLVM_COMPONENTS").split_whitespace().find(|s| s == &component).is_some()
}
#[track_caller]
#[must_use]
pub fn uname() -> String {
let caller = panic::Location::caller();
let mut uname = Command::new("uname");
let output = uname.run();
if !output.status().success() {
handle_failed_output(&uname, output, caller.line());
}
output.stdout_utf8()
}