Skip to content

Commit 5ba00db

Browse files
authored
Merge pull request #1231 from shirou/feature/process_linux_Children_fix_error_check
[process][linux] Fix error handling on Children.
2 parents 72100d4 + 35fbe38 commit 5ba00db

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

process/process_linux.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,11 @@ func (p *Process) PageFaultsWithContext(ctx context.Context) (*PageFaultsStat, e
351351
func (p *Process) ChildrenWithContext(ctx context.Context) ([]*Process, error) {
352352
pids, err := common.CallPgrepWithContext(ctx, invoke, p.Pid)
353353
if err != nil {
354-
if len(pids) == 0 {
355-
return nil, ErrorNoChildren
356-
}
357354
return nil, err
358355
}
356+
if len(pids) == 0 {
357+
return nil, ErrorNoChildren
358+
}
359359
ret := make([]*Process, 0, len(pids))
360360
for _, pid := range pids {
361361
np, err := NewProcessWithContext(ctx, pid)

0 commit comments

Comments
 (0)