Merge pull request #316 from tychoish/cpu-fix-linux
fix panic in starvation situations
This commit is contained in:
commit
c14b242c60
|
@ -201,6 +201,10 @@ func Info() ([]InfoStat, error) {
|
|||
func parseStatLine(line string) (*TimesStat, error) {
|
||||
fields := strings.Fields(line)
|
||||
|
||||
if len(fields) == 0 {
|
||||
return nil, errors.New("stat does not contain cpu info")
|
||||
}
|
||||
|
||||
if strings.HasPrefix(fields[0], "cpu") == false {
|
||||
// return CPUTimesStat{}, e
|
||||
return nil, errors.New("not contain cpu")
|
||||
|
|
Loading…
Reference in New Issue