mirror of
https://github.com/datarhei/core.git
synced 2025-10-27 09:50:27 +08:00
Fix #10
This commit is contained in:
@@ -2,6 +2,7 @@ package psutil
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/fs"
|
||||
@@ -284,6 +285,10 @@ func (u *util) cpuTimes() (*cpuTimesStat, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(times) == 0 {
|
||||
return nil, errors.New("cpu.Times() returned an empty slice")
|
||||
}
|
||||
|
||||
s := &cpuTimesStat{
|
||||
total: cpuTotal(×[0]),
|
||||
system: times[0].System,
|
||||
|
||||
Reference in New Issue
Block a user