Skip to content

Commit

Permalink
Merge pull request #426 from binjip978/return-error-on-empty-cpu-freq
Browse files Browse the repository at this point in the history
return error if cpufreq's are empty
  • Loading branch information
SuperQ authored Dec 22, 2022
2 parents 03da3a1 + b9fa528 commit 0c4b3aa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sysfs/system_cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,10 @@ func (fs FS) SystemCpufreq() ([]SystemCPUCpufreqStats, error) {
return nil, err
}

if len(systemCpufreq) == 0 {
return nil, fmt.Errorf("could not find any cpufreq files: %w", os.ErrNotExist)
}

return systemCpufreq, nil
}

Expand Down

0 comments on commit 0c4b3aa

Please sign in to comment.