cli: should return non-zero code for error (#3469)

This commit is contained in:
Michal Niewrzal 2019-11-05 06:01:26 -08:00 committed by GitHub
parent 35edc2bcc3
commit ab5c623ac7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,7 +71,10 @@ func Exec(cmd *cobra.Command) {
pflag.CommandLine.AddGoFlagSet(flag.CommandLine) pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
cleanup(cmd) cleanup(cmd)
_ = cmd.Execute() err = cmd.Execute()
if err != nil {
os.Exit(1)
}
} }
// Ctx returns the appropriate context.Context for ExecuteWithConfig commands // Ctx returns the appropriate context.Context for ExecuteWithConfig commands