Skip to content

[process][unix] err != nil when calling process.Children() for a process without child processes #1698

Description

@lichunqiang

Describe the bug
Calling Children() on a process without child processes returns a non-nil err

the source code uses common.CallPgrepWithContext which calls pgrep -P $PID. If input pid is without child processes, pgrep exit code is 1, the function call returns error with exits status 1

To Reproduce

// paste example code reproducing the bug you are reporting

Expected behavior
The function should return ErrorNoChildren?

Environment (please complete the following information):

  • Windows: [paste the result of ver]
  • Linux: [paste contents of /etc/os-release and the result of uname -a]
  • Mac OS: [paste the result of sw_vers and uname -a
  • FreeBSD: [paste the result of freebsd-version -k -r -u and uname -a]
  • OpenBSD: [paste the result of uname -a]

Additional context
[Cross-compiling? Paste the command you are using to cross-compile and the result of the corresponding go env]

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions