feat: 🎸 Hostname another way

This commit is contained in:
Atsukoro1 2022-12-05 14:02:41 +01:00
parent 2dd7c53d30
commit 6e9bad8e59

View file

@ -120,10 +120,15 @@ pub fn get_resolution() -> String {
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
pub fn get_hostname() -> String { pub fn get_hostname() -> String {
let mut hostname = file_open("/etc/hostname"); Command::new("hostname")
hostname.pop(); .output()
.expect("Failed to execute process")
hostname .stdout
.iter()
.map(|&c| c as char)
.collect::<String>()
.trim()
.to_string()
} }
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]