From ae3d6492b0af9bc052fccc082aafb79b614fb2a5 Mon Sep 17 00:00:00 2001 From: Boyang Lyu Date: Thu, 7 Nov 2024 17:05:20 +0800 Subject: [PATCH] add error code reporting in the store command Signed-off-by: Boyang Lyu --- tools/pd-ctl/pdctl/command/store_command.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/pd-ctl/pdctl/command/store_command.go b/tools/pd-ctl/pdctl/command/store_command.go index 188d36e25de..48aeae253da 100644 --- a/tools/pd-ctl/pdctl/command/store_command.go +++ b/tools/pd-ctl/pdctl/command/store_command.go @@ -19,6 +19,7 @@ import ( "encoding/json" "fmt" "net/http" + "os" "path" "strconv" "strings" @@ -381,6 +382,7 @@ func deleteStoreCommandFunc(cmd *cobra.Command, args []string) { func deleteStoreCommandByAddrFunc(cmd *cobra.Command, args []string) { id := getStoreID(cmd, args, false) if id == -1 { + os.Exit(1) return } // delete store by its ID @@ -388,6 +390,7 @@ func deleteStoreCommandByAddrFunc(cmd *cobra.Command, args []string) { _, err := doRequest(cmd, prefix, http.MethodDelete, http.Header{}) if err != nil { cmd.Printf("Failed to delete store %s: %s\n", args[0], err) + os.Exit(1) return } cmd.Println("Success!")