Skip to content

Commit

Permalink
Fix cgroup path computation
Browse files Browse the repository at this point in the history
In testing scenarios, the process path is not necessarily
`/proc/<pid>/cgroup`, but `fixtures/<pid>/cgroup` or similar.

Signed-off-by: Nathan Monfils <[email protected]>
  • Loading branch information
azertyfun authored and discordianfish committed Jul 21, 2021
1 parent 139df5d commit 8506463
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion proc_cgroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 8506463

Please sign in to comment.