MCPcopy
hub / github.com/containerd/containerd / PidOf

Function PidOf

integration/main_test.go:694–704  ·  view source on GitHub ↗

PidOf returns pid of a process by name.

(name string)

Source from the content-addressed store, hash-verified

692
693// PidOf returns pid of a process by name.
694func PidOf(name string) (int, error) {
695 b, err := exec.Command("pidof", "-s", name).CombinedOutput()
696 output := strings.TrimSpace(string(b))
697 if err != nil {
698 if len(output) != 0 {
699 return 0, fmt.Errorf("failed to run pidof %q - error: %v, output: %q", name, err, output)
700 }
701 return 0, nil
702 }
703 return strconv.Atoi(output)
704}
705
706// PidsOf returns pid(s) of a process by name
707func PidsOf(name string) ([]int, error) {

Callers 1

RestartContainerdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…