diff --git a/src/meta_plugin/hostname.rs b/src/meta_plugin/hostname.rs index ec40e66..83d62a7 100644 --- a/src/meta_plugin/hostname.rs +++ b/src/meta_plugin/hostname.rs @@ -1,4 +1,3 @@ -use gethostname::gethostname; use crate::meta_plugin::MetaPlugin; #[derive(Debug, Clone, Default)] @@ -49,8 +48,13 @@ impl HostnameMetaPlugin { } fn get_hostname(&self) -> String { - match gethostname().into_string() { - Ok(hostname) => hostname, + match hostname::get() { + Ok(hostname_os) => { + match hostname_os.into_string() { + Ok(hostname) => hostname, + Err(_) => "unknown".to_string(), + } + } Err(_) => "unknown".to_string(), } }