ListProcesses through PID when cgroup is not found in Linux (#25198)

* ListProcesses through PID when cgroup is not found

* add changelog entry

* update the ListByPid for windows
This commit is contained in:
Simon Zou
2025-03-06 16:41:51 +00:00
committed by GitHub
parent 149141e831
commit 73ceacd236
5 changed files with 15 additions and 6 deletions

View File

@@ -103,7 +103,13 @@ func (e *UniversalExecutor) setSubCmdCgroup(cmd *exec.Cmd, cgroup string) (func(
}
func (e *UniversalExecutor) ListProcesses() set.Collection[procstats.ProcessID] {
return procstats.List(e.command)
switch cgroupslib.GetMode() {
case cgroupslib.OFF:
// cgroup is unavailable, could possibly due to rootless nomad client
return procstats.ListByPid(e.childCmd.Process.Pid)
default:
return procstats.List(e.command)
}
}
func (e *UniversalExecutor) statCG(cgroup string) (int, func(), error) {