提交 97bcc355 编写于 作者: S Shirou WAKAYAMA

[process]linux: change to use exec.LookPath to invoke lsof.

上级 821a0141
...@@ -8,6 +8,7 @@ import ( ...@@ -8,6 +8,7 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"os/exec"
"path/filepath" "path/filepath"
"strconv" "strconv"
"strings" "strings"
...@@ -673,7 +674,11 @@ func callLsof(arg string, pid int32) ([]string, error) { ...@@ -673,7 +674,11 @@ func callLsof(arg string, pid int32) ([]string, error) {
} else { } else {
cmd = []string{"-a", "-F" + arg, "-p", strconv.Itoa(int(pid))} cmd = []string{"-a", "-F" + arg, "-p", strconv.Itoa(int(pid))}
} }
out, err := invoke.Command("/usr/bin/lsof", cmd...) lsof, err := exec.LookPath("lsof")
if err != nil {
return []string{}, err
}
out, err := invoke.Command(lsof, cmd...)
if err != nil { if err != nil {
return []string{}, err return []string{}, err
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册