Skip to content

Commit

Permalink
a little change
Browse files Browse the repository at this point in the history
  • Loading branch information
xin053 committed Feb 25, 2019
1 parent a667888 commit 156f3b0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hsperfdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package hsperfdata
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
"io"
"io/ioutil"
Expand Down Expand Up @@ -187,8 +188,8 @@ func DataPathsByProcessName(processName string) (map[string]string, error) {
} else {
out, err = exec.Command("sh", "-c", "ps -ef|grep -i "+processName+"|grep -v grep").Output()
}
if err != nil {
return nil, err
if err != nil || len(out) == 0 {
return nil, errors.New(processName + " is not running.")
}

filePaths := make(map[string]string)
Expand Down Expand Up @@ -336,3 +337,4 @@ func ReadPerfData(filepath string, parserTime bool) (map[string]interface{}, err
}
return entryMap, nil
}

0 comments on commit 156f3b0

Please sign in to comment.