Fix intermittent failures in TestPidOf {procfs}

Bailout if WalkFunc is called with an error.

Fixes #30377
pull/6/head
Davanum Srinivas 2016-08-10 17:23:54 -04:00
parent eef8bfec23
commit e1ad642da0
1 changed files with 3 additions and 0 deletions

View File

@ -65,6 +65,9 @@ func (pfs *ProcFS) GetFullContainerName(pid int) (string, error) {
func PidOf(name string) []int {
pids := []int{}
filepath.Walk("/proc", func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
base := filepath.Base(path)
// Traverse only the directories we are interested in
if info.IsDir() && path != "/proc" {