Merge pull request #1231 from shirou/feature/process_linux_Children_fix_error_check

[process][linux] Fix error handling on Children.
pull/1238/head
shirou 3 years ago committed by GitHub
commit 5ba00db577
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -351,11 +351,11 @@ func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, e
func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) {
pids, err := common.CallPgrepWithContext(ctx, invoke, p.Pid)
if err != nil {
if len(pids) == 0 {
return nil, ErrorNoChildren
}
return nil, err
}
if len(pids) == 0 {
return nil, ErrorNoChildren
}
ret := make([]*Process, 0, len(pids))
for _, pid := range pids {
np, err := NewProcessWithContext(ctx, pid)

Loading…
Cancel
Save