diff --git a/cmd/cp-main.go b/cmd/cp-main.go index ee6304eb..cd50c186 100644 --- a/cmd/cp-main.go +++ b/cmd/cp-main.go @@ -659,6 +659,11 @@ loop: } } + // Source has error + if errSeen && totalObjects == 0 && retErr == nil { + retErr = exitStatus(globalErrorExitStatus) + } + return retErr } diff --git a/cmd/cp-url.go b/cmd/cp-url.go index cdf363c3..9e3325db 100644 --- a/cmd/cp-url.go +++ b/cmd/cp-url.go @@ -361,6 +361,10 @@ func prepareCopyURLs(ctx context.Context, o prepareCopyURLsOpts) chan URLs { go func() { defer close(finalCopyURLsCh) for cpURLs := range copyURLsCh { + if cpURLs.Error != nil { + finalCopyURLsCh <- cpURLs + continue + } // Skip objects older than --older-than parameter if specified if o.olderThan != "" && isOlder(cpURLs.SourceContent.Time, o.olderThan) { continue