mirror of
https://github.com/shirou/gopsutil.git
synced 2025-05-01 13:48:52 +08:00
process: if pid < 0, skip it. and Cmdline retruned Joined string.
This commit is contained in:
parent
19e34cf385
commit
6227460dc5
@ -44,8 +44,10 @@ func Pids() ([]int32, error) {
|
||||
}
|
||||
|
||||
for _, p := range procs {
|
||||
if p.Pid > 0 {
|
||||
ret = append(ret, p.Pid)
|
||||
}
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
@ -72,7 +74,10 @@ func (p *Process) Exe() (string, error) {
|
||||
}
|
||||
func (p *Process) Cmdline() (string, error) {
|
||||
r, err := callPs("command", p.Pid)
|
||||
return r[0], err
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return strings.Join(r, " "), err
|
||||
}
|
||||
func (p *Process) CreateTime() (int64, error) {
|
||||
return 0, common.NotImplementedError
|
||||
|
Loading…
x
Reference in New Issue
Block a user