diff --git a/commands/commands.go b/commands/commands.go index a36034978..9e2722234 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -36,7 +36,7 @@ var _ = cmd(catDebug, &cli.Command{ }) // Run will execute the CLI -func Run(v string) error { +func Run(v string) int { version = v app := cli.NewApp() app.Version = version @@ -46,8 +46,10 @@ func Run(v string) error { sort.Sort(cli.CommandsByName(commands)) app.Commands = commands app.EnableBashCompletion = true - app.Run(os.Args) - return nil + if err := app.Run(os.Args); err != nil { + return 1 + } + return 0 } // Shared config types diff --git a/main.go b/main.go index a7bce1c38..37f99c847 100644 --- a/main.go +++ b/main.go @@ -3,6 +3,7 @@ package main import ( "fmt" "log" + "os" "strconv" "time" @@ -14,7 +15,7 @@ import ( func main() { log.SetFlags(log.LstdFlags | log.Lshortfile) - commands.Run(versionString()) + os.Exit(commands.Run(versionString())) } // Version management. 2 Goals: