Skip to content

Commit 0c4b3aa

Browse files
authored
Merge pull request #426 from binjip978/return-error-on-empty-cpu-freq
return error if cpufreq's are empty
2 parents 03da3a1 + b9fa528 commit 0c4b3aa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sysfs/system_cpu.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ func (fs FS) SystemCpufreq() ([]SystemCPUCpufreqStats, error) {
181181
return nil, err
182182
}
183183

184+
if len(systemCpufreq) == 0 {
185+
return nil, fmt.Errorf("could not find any cpufreq files: %w", os.ErrNotExist)
186+
}
187+
184188
return systemCpufreq, nil
185189
}
186190

0 commit comments

Comments
 (0)