diff --git a/process/process_linux.go b/process/process_linux.go index 8bac376..1367b5c 100644 --- a/process/process_linux.go +++ b/process/process_linux.go @@ -69,10 +69,8 @@ func (m MemoryMapsStat) String() string { // to get more information about the process. An error will be returned // if the process does not exist. func NewProcess(pid int32) (*Process, error) { - if _, err := os.Stat(common.HostProc(strconv.Itoa(int(p.Pid)))); err != nil { - return nil, err - } - return &Process{Pid: int32(pid)}, nil + _, err := os.Stat(common.HostProc(strconv.Itoa(int(pid)))) + return &Process{Pid: pid}, err } // Ppid returns Parent Process ID of the process.