ef2a826636
full diff: https://github.com/gotestyourself/gotest.tools/compare/v3.1.0...v3.3.0 - golden: accept -update for updating files - assert: golden variables Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
25 lines
346 B
Go
25 lines
346 B
Go
package icmd
|
|
|
|
import (
|
|
"errors"
|
|
|
|
exec "golang.org/x/sys/execabs"
|
|
)
|
|
|
|
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
|
|
}
|