mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Remove testutil.ParseCgroupPaths
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
@@ -3,6 +3,8 @@ package main
|
||||
import (
|
||||
"os/exec"
|
||||
|
||||
"strings"
|
||||
|
||||
"github.com/docker/docker/pkg/testutil/cmd"
|
||||
)
|
||||
|
||||
@@ -30,3 +32,17 @@ func transformCmd(execCmd *exec.Cmd) cmd.Cmd {
|
||||
Stdout: execCmd.Stdout,
|
||||
}
|
||||
}
|
||||
|
||||
// ParseCgroupPaths parses 'procCgroupData', which is output of '/proc/<pid>/cgroup', and returns
|
||||
// a map which cgroup name as key and path as value.
|
||||
func ParseCgroupPaths(procCgroupData string) map[string]string {
|
||||
cgroupPaths := map[string]string{}
|
||||
for _, line := range strings.Split(procCgroupData, "\n") {
|
||||
parts := strings.Split(line, ":")
|
||||
if len(parts) != 3 {
|
||||
continue
|
||||
}
|
||||
cgroupPaths[parts[1]] = parts[2]
|
||||
}
|
||||
return cgroupPaths
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user