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

This commit is contained in:
Shirou WAKAYAMA 2016-02-23 15:13:24 +09:00
parent 821a0141b1
commit 97bcc355a6
1 changed files with 6 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"path/filepath"
"strconv"
"strings"
@ -673,7 +674,11 @@ func callLsof(arg string, pid int32) ([]string, error) {
} else {
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 {
return []string{}, err
}