From a0f5e6c8936d788b4c9f52338f213963f14c15fd Mon Sep 17 00:00:00 2001 From: mirkobrombin Date: Wed, 23 Aug 2023 18:50:58 +0200 Subject: [PATCH] fix:[close #116] Upgrade cmd does not return proper exit code --- cmd/upgrade.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/upgrade.go b/cmd/upgrade.go index e370b332..2b8a08e3 100644 --- a/cmd/upgrade.go +++ b/cmd/upgrade.go @@ -14,6 +14,8 @@ package cmd */ import ( + "os" + "github.com/spf13/cobra" "github.com/vanilla-os/abroot/core" @@ -69,8 +71,10 @@ func upgrade(cmd *cobra.Command, args []string) error { _, res := aBsys.CheckUpdate() if res { cmdr.Info.Println(abroot.Trans("upgrade.updateAvailable")) + os.Exit(0) } else { cmdr.Info.Println(abroot.Trans("upgrade.noUpdateAvailable")) + os.Exit(1) } return nil } @@ -92,12 +96,13 @@ func upgrade(cmd *cobra.Command, args []string) error { if err != nil { if err == core.NoUpdateError { cmdr.Info.Println(abroot.Trans("upgrade.noUpdateAvailable")) - return nil + return err } cmdr.Error.Println(err) return err } + os.Exit(0) return nil }