Skip to content

Commit

Permalink
return error if cpufreq's are empty
Browse files Browse the repository at this point in the history
Signed-off-by: Sergei Semenchuk <pdp.eleven11@gmail.com>
  • Loading branch information
binjip978 committed Dec 21, 2022
1 parent 03da3a1 commit b9fa528
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sysfs/system_cpu.go
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 b9fa528

Please sign in to comment.