Commit e1ad642d authored by Davanum Srinivas's avatar Davanum Srinivas

Fix intermittent failures in TestPidOf {procfs}

Bailout if WalkFunc is called with an error. Fixes #30377
parent eef8bfec
...@@ -65,6 +65,9 @@ func (pfs *ProcFS) GetFullContainerName(pid int) (string, error) { ...@@ -65,6 +65,9 @@ func (pfs *ProcFS) GetFullContainerName(pid int) (string, error) {
func PidOf(name string) []int { func PidOf(name string) []int {
pids := []int{} pids := []int{}
filepath.Walk("/proc", func(path string, info os.FileInfo, err error) error { filepath.Walk("/proc", func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
base := filepath.Base(path) base := filepath.Base(path)
// Traverse only the directories we are interested in // Traverse only the directories we are interested in
if info.IsDir() && path != "/proc" { if info.IsDir() && path != "/proc" {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment