Update sensors warning check

This commit is contained in:
Svilen Markov
2025-04-15 03:37:38 +01:00
parent 41e74ba9b5
commit 5214fb9145
2 changed files with 11 additions and 6 deletions

View File

@@ -96,15 +96,19 @@ func parseCliOptions() (*cliOptions, error) {
func cliSensorsPrint() int {
tempSensors, err := sensors.SensorsTemperatures()
if err != nil {
fmt.Printf("Errors encountered while retrieving list of sensors:\n %v\n", err)
if warns, ok := err.(*sensors.Warnings); ok {
fmt.Printf("Could not retrieve information for some sensors (%v):\n", err)
for _, w := range warns.List {
fmt.Printf(" - %v\n", w)
}
fmt.Println()
} else {
fmt.Printf("Failed to retrieve sensor information: %v\n", err)
return 1
}
}
if tempSensors == nil || len(tempSensors) == 0 {
if len(tempSensors) == 0 {
fmt.Println("No sensors found")
return 0
}