Skip to content

Commit

Permalink
Fixes #130. Any warning or error from gopsutil was preventing any tem…
Browse files Browse the repository at this point in the history
…ps from being displayed, even if some had useful data.
  • Loading branch information
xxxserxxx committed Nov 30, 2020
1 parent c5a8d0f commit 3d00d34
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions devices/cpu_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

package devices

// TODO gopsutil is at v3, and we're using v2. See if v3 is released and upgrade if so.
import "github.com/shirou/gopsutil/cpu"

func CpuCount() (int, error) {
Expand Down
8 changes: 6 additions & 2 deletions devices/temp_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package devices

import (
"log"
"strings"

"github.com/shirou/gopsutil/host"
Expand All @@ -15,8 +16,11 @@ func devs() []string {
}
sensors, err := host.SensorsTemperatures()
if err != nil {
// FIXME report the error
return []string{}
log.Printf("gopsutil reports %s", err)
if len(sensors) == 0 {
log.Printf("no temperature sensors returned")
return []string{}
}
}
rv := make([]string, 0, len(sensors))
for _, sensor := range sensors {
Expand Down

0 comments on commit 3d00d34

Please sign in to comment.