diff --git a/internal/glance/cli.go b/internal/glance/cli.go index 8e0fc32..34c8dff 100644 --- a/internal/glance/cli.go +++ b/internal/glance/cli.go @@ -96,22 +96,22 @@ func parseCliOptions() (*cliOptions, error) { func cliSensorsPrint() int { tempSensors, err := sensors.SensorsTemperatures() if err != nil { - fmt.Printf("Failed to retrieve list of sensors: %v\n", err) + fmt.Printf("Errors encountered while retrieving list of sensors:\n %v\n", err) if warns, ok := err.(*sensors.Warnings); ok { for _, w := range warns.List { fmt.Printf(" - %v\n", w) } } - return 1 } - if len(tempSensors) == 0 { + if tempSensors == nil || len(tempSensors) == 0 { fmt.Println("No sensors found") return 0 } + fmt.Println("Sensors found:") for _, sensor := range tempSensors { - fmt.Printf("%s: %.1f°C\n", sensor.SensorKey, sensor.Temperature) + fmt.Printf(" %s: %.1f°C\n", sensor.SensorKey, sensor.Temperature) } return 0 diff --git a/pkg/sysinfo/sysinfo.go b/pkg/sysinfo/sysinfo.go index 1ed8c75..9a35710 100644 --- a/pkg/sysinfo/sysinfo.go +++ b/pkg/sysinfo/sysinfo.go @@ -205,7 +205,7 @@ func Collect(req *SystemInfoRequest) (*SystemInfo, []error) { // also disabled on openbsd because it's not implemented by go-psutil if runtime.GOOS != "windows" && runtime.GOOS != "openbsd" { sensorReadings, err := sensors.SensorsTemperatures() - if err == nil { + if sensorReadings != nil && len(sensorReadings) > 0 { if req.CPUTempSensor != "" { for i := range sensorReadings { if sensorReadings[i].SensorKey == req.CPUTempSensor {