From 2c22655f152d2cdf1a1f3a1e8a782bd91d9b0141 Mon Sep 17 00:00:00 2001 From: Guiheux Steven Date: Fri, 18 Jun 2021 16:08:08 +0200 Subject: [PATCH] fix(worker,engine): return 1 when command not found (#5851) --- engine/main.go | 4 +++- engine/worker/main.go | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/engine/main.go b/engine/main.go index f91240e1a3..9fb6fd82b0 100644 --- a/engine/main.go +++ b/engine/main.go @@ -23,7 +23,9 @@ func init() { } func main() { - mainCmd.Execute() + if err := mainCmd.Execute(); err != nil { + os.Exit(1) + } } var mainCmd = &cobra.Command{ diff --git a/engine/worker/main.go b/engine/worker/main.go index 3c1a2f45a6..20cecce0f0 100644 --- a/engine/worker/main.go +++ b/engine/worker/main.go @@ -1,5 +1,9 @@ package main +import ( + "os" +) + func main() { cmd := cmdMain() cmd.AddCommand(cmdExport) @@ -22,5 +26,7 @@ func main() { // last command: doc, this command is hidden cmd.AddCommand(cmdDoc(cmd)) - cmd.Execute() + if err := cmd.Execute(); err != nil { + os.Exit(1) + } }