Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
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
Expand Down