Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit cb3d019

Browse files
authored
Merge pull request #64 from chris-crone/iss-63
Exit code 1 on error
2 parents 7fbffe6 + de4c985 commit cb3d019

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

cmd/root.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package cmd
22

33
import (
4+
"os"
5+
46
"github.com/spf13/cobra"
57
)
68

@@ -22,7 +24,9 @@ func firstOrEmpty(list []string) string {
2224
// Execute adds all child commands to the root command and sets flags appropriately.
2325
// This is called by main.main(). It only needs to happen once to the rootCmd.
2426
func Execute() {
25-
rootCmd.Execute()
27+
if err := rootCmd.Execute(); err != nil {
28+
os.Exit(1)
29+
}
2630
}
2731

2832
func init() {

0 commit comments

Comments
 (0)