Skip to content

Commit

Permalink
fixed gpu temp with netbsd, version 0.5.9
Browse files Browse the repository at this point in the history
  • Loading branch information
charklie committed May 18, 2024
1 parent 7d354ad commit 21f91be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rsftch"
version = "0.5.8"
version = "0.5.9"
edition = "2021"
authors = ["Charklie charliejohanid@gmail.com"]
license = "MIT"
Expand Down
5 changes: 3 additions & 2 deletions src/fns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,13 @@ pub fn get_cpu_temp() -> String {
{
Command::new("envstat")
.arg("-d")
.arg("acpitz0")
.output()
.ok()
.and_then(|output| String::from_utf8(output.stdout).ok())
.and_then(|output_str| {
output_str.lines().find(|line| line.contains("cpu0 temperature"))
.and_then(|line| line.split_whitespace().nth(2))
output_str.lines().next()
.and_then(|line| line.split_whitespace().nth(1))
.and_then(|temp_str| temp_str.parse::<f64>().ok())
.map(|temp| format!("{:.1}°C", temp))
})
Expand Down

0 comments on commit 21f91be

Please sign in to comment.