diff options
author | Sean E. Russell <ser@ser1.net> | 2020-11-30 10:35:24 -0600 |
---|---|---|
committer | Sean E. Russell <ser@ser1.net> | 2020-11-30 10:35:24 -0600 |
commit | 3d00d349c6eeac3f3c33444a0c867b1927182ad3 (patch) | |
tree | 2de43f0c8c8e573c9c5eba9cf9ddf3dc38a41824 | |
parent | c5a8d0f32f82223a4c1ac0b7661d97ac95188491 (diff) |
Fixes #130. Any warning or error from gopsutil was preventing any temps from being displayed, even if some had useful data.
-rw-r--r-- | devices/cpu_linux.go | 1 | ||||
-rw-r--r-- | devices/temp_linux.go | 8 |
2 files changed, 7 insertions, 2 deletions
diff --git a/devices/cpu_linux.go b/devices/cpu_linux.go index 4e836d5..2368218 100644 --- a/devices/cpu_linux.go +++ b/devices/cpu_linux.go @@ -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) { diff --git a/devices/temp_linux.go b/devices/temp_linux.go index 0bd480f..b738002 100644 --- a/devices/temp_linux.go +++ b/devices/temp_linux.go @@ -3,6 +3,7 @@ package devices import ( + "log" "strings" "github.com/shirou/gopsutil/host" @@ -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 { |