feat: switch to hostname crate for full hostname resolution

Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-26 21:15:19 -03:00
parent 0b751ca34b
commit 2a94f5f155

View File

@@ -1,4 +1,3 @@
use gethostname::gethostname;
use crate::meta_plugin::MetaPlugin; use crate::meta_plugin::MetaPlugin;
#[derive(Debug, Clone, Default)] #[derive(Debug, Clone, Default)]
@@ -49,11 +48,16 @@ impl HostnameMetaPlugin {
} }
fn get_hostname(&self) -> String { fn get_hostname(&self) -> String {
match gethostname().into_string() { match hostname::get() {
Ok(hostname_os) => {
match hostname_os.into_string() {
Ok(hostname) => hostname, Ok(hostname) => hostname,
Err(_) => "unknown".to_string(), Err(_) => "unknown".to_string(),
} }
} }
Err(_) => "unknown".to_string(),
}
}
} }
impl MetaPlugin for HostnameMetaPlugin { impl MetaPlugin for HostnameMetaPlugin {