mirror of
https://github.com/Atsukoro1/ponyfetch.git
synced 2024-11-23 12:47: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")]
|
#[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")]
|
||||||
|
|
Loading…
Reference in a new issue