From 8506463359f1d69d08805f7a4db1a2711576e76e Mon Sep 17 00:00:00 2001 From: Nathan Monfils Date: Tue, 20 Jul 2021 14:16:32 +0200 Subject: [PATCH] Fix cgroup path computation In testing scenarios, the process path is not necessarily `/proc//cgroup`, but `fixtures//cgroup` or similar. Signed-off-by: Nathan Monfils --- proc_cgroup.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proc_cgroup.go b/proc_cgroup.go index 0094a13c0..be45b7987 100644 --- a/proc_cgroup.go +++ b/proc_cgroup.go @@ -90,7 +90,7 @@ func parseCgroups(data []byte) ([]Cgroup, error) { // control hierarchy running on this system. On every system (v1 and v2), all hierarchies contain all processes, // so the len of the returned struct is equal to the number of active hierarchies on this system func (p Proc) Cgroups() ([]Cgroup, error) { - data, err := util.ReadFileNoStat(fmt.Sprintf("/proc/%d/cgroup", p.PID)) + data, err := util.ReadFileNoStat(p.path("cgroup")) if err != nil { return nil, err }