Skip to content

Commit

Permalink
ignore wait4 errs in observe max-err-count
Browse files Browse the repository at this point in the history
  • Loading branch information
juanvallejo committed Mar 16, 2018
1 parent 751b4fa commit f28463a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pkg/oc/cli/cmd/observe/observe.go
Original file line number Diff line number Diff line change
Expand Up @@ -716,9 +716,27 @@ func measureCommandDuration(m *prometheus.SummaryVec, fn func() error, labels ..
statusCode = -1
}
m.WithLabelValues(append(labels, strconv.Itoa(statusCode))...).Observe(float64(duration / time.Millisecond))

if errnoError(err) == syscall.ECHILD {
// ignore wait4 syscall errno as it means
// that the subprocess has started and ended
// before the wait call was made.
return nil
}

return err
}

func errnoError(err error) syscall.Errno {
syscallErr := err.(*os.SyscallError)
errno, ok := syscallErr.Err.(syscall.Errno)
if ok {
return errno
}

return 0
}

func exitCodeForCommandError(err error) (int, bool) {
if err == nil {
return 0, true
Expand Down

0 comments on commit f28463a

Please sign in to comment.