From 9dcf37de02c288dab646f333c0446f9e96d8f2f1 Mon Sep 17 00:00:00 2001 From: Haveiss Date: Tue, 17 Dec 2024 18:49:59 +0700 Subject: [PATCH] fix(run): return correct exit code on recipe failure --- cmd/run.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/run.go b/cmd/run.go index 9d5b1386..3b59a412 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -134,12 +134,15 @@ func RunCmd() *cobra.Command { // Print the report if failures > 0 { fmt.Println("\nSome recipes were not successful") + err = fmt.Errorf("%d recipes failed", failures) + // Disable usage message on recipe failure + cmd.SilenceUsage = true } else { fmt.Println("\nAll recipes ran successful") } fmt.Printf("%d failing, %d successful, and %d total\n\n", failures, success, len(recipes)) printer.Table(os.Stdout, report) - return nil + return err }, }