summaryrefslogtreecommitdiff
path: root/tests/test_helpers
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_helpers')
-rw-r--r--tests/test_helpers/helpers.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/test_helpers/helpers.go b/tests/test_helpers/helpers.go
index e7fcf4b..ef748e2 100644
--- a/tests/test_helpers/helpers.go
+++ b/tests/test_helpers/helpers.go
@@ -433,9 +433,14 @@ func ExtractCmdExitCode(err error) int {
return 0
}
// OMG this is convoluted
- err2 := err.(*exec.ExitError)
- code := err2.Sys().(syscall.WaitStatus).ExitStatus()
- return code
+ if err2, ok := err.(*exec.ExitError); ok {
+ return err2.Sys().(syscall.WaitStatus).ExitStatus()
+ }
+ if err2, ok := err.(*os.PathError); ok {
+ return int(err2.Err.(syscall.Errno))
+ }
+ log.Panicf("could not decode error %#v", err)
+ return 0
}
// ListFds lists our open file descriptors.