Skip to content

Commit

Permalink
fix:[close #116] Upgrade cmd does not return proper exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
mirkobrombin committed Aug 23, 2023
1 parent 8f28e57 commit a0f5e6c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmd/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ package cmd
*/

import (
"os"

"github.com/spf13/cobra"

"github.com/vanilla-os/abroot/core"
Expand Down Expand Up @@ -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
}
Expand All @@ -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
}

0 comments on commit a0f5e6c

Please sign in to comment.