[process][linux] Fix NewProcess() on Linux
Related to #704. Don't break previous API where a Process is always returned, fix undefined variable p.
This commit is contained in:
parent
99169acbd8
commit
2ac72f1fa1
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue