mirror of
https://github.com/Atsukoro1/ponyfetch.git
synced 2024-11-27 06:17:59 +01:00
feat: 🎸 Hostname another way
This commit is contained in:
parent
2dd7c53d30
commit
6e9bad8e59
1 changed files with 9 additions and 4 deletions
|
@ -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::<String>()
|
||||
.trim()
|
||||
.to_string()
|
||||
}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
|
|
Loading…
Reference in a new issue