From 7a86f5170b829a8b05309dd3554dac2d663e54a7 Mon Sep 17 00:00:00 2001 From: Joe Paul Date: Fri, 15 Jul 2022 18:56:07 +0530 Subject: [PATCH] fix: Set exit flag when create/delete command fails --- cmd/kaf/topic.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/kaf/topic.go b/cmd/kaf/topic.go index 5227ee6..9ad07e3 100644 --- a/cmd/kaf/topic.go +++ b/cmd/kaf/topic.go @@ -279,7 +279,7 @@ var createTopicCmd = &cobra.Command{ }, }, false) if err != nil { - fmt.Printf("Could not create topic %v: %v\n", topicName, err.Error()) + errorExit("Could not create topic %v: %v\n", topicName, err.Error()) } else { w := tabwriter.NewWriter(outWriter, tabwriterMinWidth, tabwriterWidth, tabwriterPadding, tabwriterPadChar, tabwriterFlags) fmt.Fprintf(w, "\xE2\x9C\x85 Created topic!\n") @@ -325,7 +325,7 @@ var deleteTopicCmd = &cobra.Command{ topicName := args[0] err := admin.DeleteTopic(topicName) if err != nil { - fmt.Fprintf(outWriter, "Could not delete topic %v: %v\n", topicName, err.Error()) + errorExit("Could not delete topic %v: %v\n", topicName, err.Error()) } else { fmt.Fprintf(outWriter, "\xE2\x9C\x85 Deleted topic %v!\n", topicName) }