Make $nu constant (#10160)

This commit is contained in:
Jakub Žádník
2023-09-01 09:18:55 +03:00
committed by GitHub
parent 7d6b23ee2f
commit f35808cb89
13 changed files with 284 additions and 218 deletions

View File

@ -3,6 +3,7 @@ mod foreground;
mod linux;
#[cfg(target_os = "macos")]
mod macos;
pub mod os_info;
#[cfg(target_os = "windows")]
mod windows;

View File

@ -0,0 +1,21 @@
use sysinfo::SystemExt;
pub fn get_os_name() -> &'static str {
std::env::consts::OS
}
pub fn get_os_arch() -> &'static str {
std::env::consts::ARCH
}
pub fn get_os_family() -> &'static str {
std::env::consts::FAMILY
}
pub fn get_kernel_version() -> String {
let sys = sysinfo::System::new();
match sys.kernel_version() {
Some(v) => v,
None => "unknown".to_string(),
}
}