From 6e9bad8e599ef020ada0ce49e5c899268ed1ee34 Mon Sep 17 00:00:00 2001 From: Atsukoro1 Date: Mon, 5 Dec 2022 14:02:41 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20Hostname=20another=20way?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/system/host.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/system/host.rs b/src/system/host.rs index ba38e52..c3be343 100644 --- a/src/system/host.rs +++ b/src/system/host.rs @@ -120,10 +120,15 @@ pub fn get_resolution() -> String { #[cfg(target_os = "linux")] pub fn get_hostname() -> String { - let mut hostname = file_open("/etc/hostname"); - hostname.pop(); - - hostname + Command::new("hostname") + .output() + .expect("Failed to execute process") + .stdout + .iter() + .map(|&c| c as char) + .collect::() + .trim() + .to_string() } #[cfg(target_os = "linux")]