diff --git a/common/common.go b/common/common.go index a795361..efefbf0 100644 --- a/common/common.go +++ b/common/common.go @@ -17,7 +17,7 @@ import ( var NotImplementedError = errors.New("not implemented yet") -// ReadLines reads contents from file and splits them by new line. +// ReadLines reads contents from a file and splits them by new lines. // A convenience wrapper to ReadLinesOffsetN(filename, 0, -1). func ReadLines(filename string) ([]string, error) { return ReadLinesOffsetN(filename, 0, -1) diff --git a/process/process_darwin.go b/process/process_darwin.go index 2a49ead..d979337 100644 --- a/process/process_darwin.go +++ b/process/process_darwin.go @@ -215,6 +215,10 @@ func convertCpuTimes(s string) (ret float64, err error) { func (p *Process) CPUTimes() (*cpu.CPUTimesStat, error) { r, err := callPs("utime,stime", p.Pid, false) + if err != nil { + return nil, err + } + utime, err := convertCpuTimes(r[0][0]) if err != nil { return nil, err