From 2a3c3ed18e5ee68fade60465d8692315f17b622d Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Fri, 7 Dec 2018 03:14:10 +0000 Subject: [PATCH] Non-zero exit status if something failed --- main.go | 4 ++++ pew.go | 3 +++ 2 files changed, 7 insertions(+) diff --git a/main.go b/main.go index c82e3c6..0d91fd4 100644 --- a/main.go +++ b/main.go @@ -193,4 +193,8 @@ func main() { if err != nil { log.Fatalln(err) } + + if somethingFailed { + os.Exit(1) + } } diff --git a/pew.go b/pew.go index 3ec94c2..e8ac172 100644 --- a/pew.go +++ b/pew.go @@ -24,6 +24,8 @@ import ( qemu "github.com/jollheef/out-of-tree/qemu" ) +var somethingFailed = false + func dockerCommand(container, workdir, timeout, command string) *exec.Cmd { return exec.Command("timeout", "-k", timeout, timeout, "docker", "run", "-v", workdir+":/work", container, @@ -116,6 +118,7 @@ func genOkFail(name string, ok bool) aurora.Value { s := " " + name + " SUCCESS " return aurora.BgGreen(aurora.Black(s)) } else { + somethingFailed = true s := " " + name + " FAILURE " return aurora.BgRed(aurora.Gray(aurora.Bold(s))) }