From 3c0f1424ed74f5a1149695beb1cf2c0fcb9316c7 Mon Sep 17 00:00:00 2001 From: Praveenrajmani Date: Tue, 18 Sep 2018 19:31:18 +0530 Subject: [PATCH] `mc heal` and `mc mirror` should respond with proper exit code respond with os.exit(0) incase of errors Fixes #2534 #2474 --- cmd/admin-heal.go | 2 +- cmd/typed-errors.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/admin-heal.go b/cmd/admin-heal.go index 9dfe73e9b1..3bf9f2c166 100644 --- a/cmd/admin-heal.go +++ b/cmd/admin-heal.go @@ -131,5 +131,5 @@ func mainAdminHeal(ctx *cli.Context) error { "Unable to display follow heal status.", ) - return nil + return herr } diff --git a/cmd/typed-errors.go b/cmd/typed-errors.go index fd1590e828..50665be447 100644 --- a/cmd/typed-errors.go +++ b/cmd/typed-errors.go @@ -96,11 +96,13 @@ var errInvalidTarget = func(URL string) *probe.Error { return probe.NewError(invalidTargetErr(errors.New(msg))).Untrace() } -type overwriteNotAllowedErr error +type overwriteNotAllowedErr struct { + error +} var errOverWriteNotAllowed = func(URL string) *probe.Error { msg := "Overwrite not allowed for `" + URL + "`. Use `--overwrite` to override this behavior." - return probe.NewError(overwriteNotAllowedErr(errors.New(msg))) + return probe.NewError(overwriteNotAllowedErr{errors.New(msg)}) } type sourceIsDirErr error