From cc2497f52f4f1e89fe5ec44d90ed83b9a85b9687 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 4 Jan 2018 07:56:43 -0800 Subject: [PATCH] Exitcode with '1' when update is available (#5354) --quiet should simply update the binary without any prompt. Fixes #5347 --- cmd/update-main.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/update-main.go b/cmd/update-main.go index 9e0feba26..5adb2bba4 100644 --- a/cmd/update-main.go +++ b/cmd/update-main.go @@ -44,7 +44,7 @@ var updateCmd = cli.Command{ Flags: []cli.Flag{ cli.BoolFlag{ Name: "quiet", - Usage: "Disable any update messages.", + Usage: "Disable any update prompt message.", }, }, CustomHelpTemplate: `Name: @@ -63,7 +63,7 @@ EXIT STATUS: EXAMPLES: 1. Check and update minio: - $ {{.HelpName} + $ {{.HelpName}} `, } @@ -476,7 +476,7 @@ func shouldUpdate(quiet bool, sha256Hex string, latestReleaseTime time.Time) (ok var greenColorSprintf = color.New(color.FgGreen, color.Bold).SprintfFunc() -func mainUpdate(ctx *cli.Context) error { +func mainUpdate(ctx *cli.Context) { if len(ctx.Args()) != 0 { cli.ShowCommandHelpAndExit(ctx, "update", -1) } @@ -498,7 +498,7 @@ func mainUpdate(ctx *cli.Context) error { // Nothing to update running the latest release. if updateMsg == "" { log.Println(greenColorSprintf("You are already running the most recent version of ‘minio’.")) - return nil + os.Exit(0) } log.Println(updateMsg) @@ -512,6 +512,6 @@ func mainUpdate(ctx *cli.Context) error { os.Exit(-1) } log.Println(successMsg) + os.Exit(1) } - return nil }