Merge pull request #30402 from dims/fix-issue-30377

Automatic merge from submit-queue

Fix intermittent failures in TestPidOf {procfs}

Bailout if WalkFunc is called with an error.

Fixes #30377

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.kubernetes.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.kubernetes.io/reviews/kubernetes/kubernetes/30402)
<!-- Reviewable:end -->
This commit is contained in:
Kubernetes Submit Queue 2016-08-11 06:47:45 -07:00 committed by GitHub
commit 342aac2ffd

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" {