Skip to content

Commit 156f3b0

Browse files
committed
a little change
1 parent a667888 commit 156f3b0

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

hsperfdata.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package hsperfdata
77
import (
88
"bytes"
99
"encoding/binary"
10+
"errors"
1011
"fmt"
1112
"io"
1213
"io/ioutil"
@@ -187,8 +188,8 @@ func DataPathsByProcessName(processName string) (map[string]string, error) {
187188
} else {
188189
out, err = exec.Command("sh", "-c", "ps -ef|grep -i "+processName+"|grep -v grep").Output()
189190
}
190-
if err != nil {
191-
return nil, err
191+
if err != nil || len(out) == 0 {
192+
return nil, errors.New(processName + " is not running.")
192193
}
193194

194195
filePaths := make(map[string]string)
@@ -336,3 +337,4 @@ func ReadPerfData(filepath string, parserTime bool) (map[string]interface{}, err
336337
}
337338
return entryMap, nil
338339
}
340+

0 commit comments

Comments
 (0)