1
0
mirror of https://github.com/docker/cli.git synced 2026-01-26 15:41:42 +03:00
Files
cli/vendor/gotest.tools/v3/icmd/exitcode.go
Sebastiaan van Stijn c855e4ba3b vendor: gotest.tools/v3 v3.4.0
- removes github.com/spf13/pflag dependency
- removes use of deprecated io/ioutil package
- drops support for go1.16

full diff: https://github.com/gotestyourself/gotest.tools/compare/v3.3.0...v3.4.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-11-05 23:25:29 +01:00

24 lines
323 B
Go

package icmd
import (
"errors"
"os/exec"
)
func processExitCode(err error) int {
if err == nil {
return 0
}
var exitErr *exec.ExitError
if errors.As(err, &exitErr) {
if exitErr.ProcessState == nil {
return 0
}
if code := exitErr.ProcessState.ExitCode(); code != -1 {
return code
}
}
return 127
}