Set exitcode on copy/mirror source failure (#4798)
Also fixes errors potentially being swallowed by filtering. Fixes #4773 ``` λ go build&&mc cp s3/default/1.mp4 1.mp4 mc: <ERROR> Unable to prepare URL for copying. Unable to guess the type of copy operation. λ echo %errorlevel% 1 λ _ ```
This commit is contained in:
@@ -659,6 +659,11 @@ loop:
|
||||
}
|
||||
}
|
||||
|
||||
// Source has error
|
||||
if errSeen && totalObjects == 0 && retErr == nil {
|
||||
retErr = exitStatus(globalErrorExitStatus)
|
||||
}
|
||||
|
||||
return retErr
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user