mirror of
https://github.com/minio/mc.git
synced 2025-11-13 12:22:45 +03:00
Do not exit for common filesystem errors - for cp, mirror
- Broken Symlink - No Such file or directory, Permission Denied - Ignore broken directory symlinks
This commit is contained in:
15
cp-main.go
15
cp-main.go
@@ -28,6 +28,7 @@ import (
|
|||||||
|
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
"github.com/minio/cli"
|
"github.com/minio/cli"
|
||||||
|
"github.com/minio/mc/pkg/client"
|
||||||
"github.com/minio/mc/pkg/console"
|
"github.com/minio/mc/pkg/console"
|
||||||
"github.com/minio/minio/pkg/probe"
|
"github.com/minio/minio/pkg/probe"
|
||||||
)
|
)
|
||||||
@@ -261,7 +262,21 @@ func doCopyCmdSession(session *sessionV2) {
|
|||||||
console.Printf("%c[2K\n", 27)
|
console.Printf("%c[2K\n", 27)
|
||||||
console.Printf("%c[A", 27)
|
console.Printf("%c[A", 27)
|
||||||
}
|
}
|
||||||
|
switch cpURLs.Error.ToGoError().(type) {
|
||||||
|
// handle this specifically for filesystem
|
||||||
|
case client.ISBrokenSymlink:
|
||||||
errorIf(cpURLs.Error.Trace(), fmt.Sprintf("Failed to copy ‘%s’.", cpURLs.SourceContent.Name))
|
errorIf(cpURLs.Error.Trace(), fmt.Sprintf("Failed to copy ‘%s’.", cpURLs.SourceContent.Name))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if os.IsNotExist(cpURLs.Error.ToGoError()) || os.IsPermission(cpURLs.Error.ToGoError()) {
|
||||||
|
if cpURLs.SourceContent != nil {
|
||||||
|
if cpURLs.SourceContent.Type.IsDir() && (cpURLs.SourceContent.Type&os.ModeSymlink == os.ModeSymlink) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
errorIf(cpURLs.Error.Trace(), fmt.Sprintf("Failed to copy ‘%s’.", cpURLs.SourceContent.Name))
|
||||||
|
continue
|
||||||
|
}
|
||||||
session.Close()
|
session.Close()
|
||||||
session.Info()
|
session.Info()
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import (
|
|||||||
|
|
||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
"github.com/minio/cli"
|
"github.com/minio/cli"
|
||||||
|
"github.com/minio/mc/pkg/client"
|
||||||
"github.com/minio/mc/pkg/console"
|
"github.com/minio/mc/pkg/console"
|
||||||
"github.com/minio/minio/pkg/probe"
|
"github.com/minio/minio/pkg/probe"
|
||||||
)
|
)
|
||||||
@@ -259,7 +260,21 @@ func doMirrorCmdSession(session *sessionV2) {
|
|||||||
console.Printf("%c[2K\n", 27)
|
console.Printf("%c[2K\n", 27)
|
||||||
console.Printf("%c[A", 27)
|
console.Printf("%c[A", 27)
|
||||||
}
|
}
|
||||||
|
switch sURLs.Error.ToGoError().(type) {
|
||||||
|
// handle this specifically for filesystem
|
||||||
|
case client.ISBrokenSymlink:
|
||||||
errorIf(sURLs.Error.Trace(), "Failed to mirror.")
|
errorIf(sURLs.Error.Trace(), "Failed to mirror.")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if os.IsNotExist(sURLs.Error.ToGoError()) || os.IsPermission(sURLs.Error.ToGoError()) {
|
||||||
|
if sURLs.SourceContent != nil {
|
||||||
|
if sURLs.SourceContent.Type.IsDir() && (sURLs.SourceContent.Type&os.ModeSymlink == os.ModeSymlink) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
errorIf(sURLs.Error.Trace(), "Failed to mirror.")
|
||||||
|
continue
|
||||||
|
}
|
||||||
session.Close()
|
session.Close()
|
||||||
session.Info()
|
session.Info()
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user