We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ee1ed1f commit 9c031b9Copy full SHA for 9c031b9
errorutil/errorutil.go
@@ -2,12 +2,14 @@
2
package errorutil
3
4
import (
5
+ "errors"
6
"os/exec"
7
"regexp"
8
)
9
10
func exitCode(err error) int {
- if exitError, ok := err.(*exec.ExitError); ok {
11
+ var exitError *exec.ExitError
12
+ if errors.As(err, &exitError) {
13
return exitError.ProcessState.ExitCode()
14
}
15
return -1
@@ -22,7 +24,7 @@ func IsExitStatusError(err error) bool {
22
24
func IsExitStatusErrorStr(errString string) bool {
23
25
// https://golang.org/src/os/exec_posix.go?s=2421:2459#L87
26
// example exit status error string: exit status 1
- var rex = regexp.MustCompile(`^exit status [0-9]{1,3}$`)
27
+ var rex = regexp.MustCompile(`^exit status \d{1,3}$`)
28
return rex.MatchString(errString)
29
30
0 commit comments