dashesToPath converts a slice name with dashes to it's corresponding systemd filesystem path.
(in string)
| 925 | |
| 926 | // dashesToPath converts a slice name with dashes to it's corresponding systemd filesystem path. |
| 927 | func dashesToPath(in string) string { |
| 928 | path := "" |
| 929 | if strings.HasSuffix(in, ".slice") && strings.Contains(in, "-") { |
| 930 | parts := strings.Split(in, "-") |
| 931 | for i := range parts { |
| 932 | s := strings.Join(parts[0:i+1], "-") |
| 933 | if !strings.HasSuffix(s, ".slice") { |
| 934 | s += ".slice" |
| 935 | } |
| 936 | path = filepath.Join(path, s) |
| 937 | } |
| 938 | } else { |
| 939 | path = filepath.Join(path, in) |
| 940 | } |
| 941 | return path |
| 942 | } |
| 943 | |
| 944 | func NewSystemd(slice, group string, pid int, resources *Resources) (*Manager, error) { |
| 945 | if slice == "" { |
no outgoing calls
no test coverage detected
searching dependent graphs…