diff --git a/pkg/oc/cli/cmd/observe/observe.go b/pkg/oc/cli/cmd/observe/observe.go index 27a11668b80c..e5823ed434be 100644 --- a/pkg/oc/cli/cmd/observe/observe.go +++ b/pkg/oc/cli/cmd/observe/observe.go @@ -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 { + if se, ok := err.(*os.SyscallError); ok { + if errno, ok := se.Err.(syscall.Errno); ok { + return errno + } + } + + return 0 +} + func exitCodeForCommandError(err error) (int, bool) { if err == nil { return 0, true