mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
Merge pull request #2115 from nagy/exitcode
Return correct exitcode when `wheed upload` fails
This commit is contained in:
commit
492a91e0b0
|
@ -84,7 +84,7 @@ func runUpload(cmd *Command, args []string) bool {
|
||||||
if *upload.dir == "" {
|
if *upload.dir == "" {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
filepath.Walk(util.ResolvePath(*upload.dir), func(path string, info os.FileInfo, err error) error {
|
err = filepath.Walk(util.ResolvePath(*upload.dir), func(path string, info os.FileInfo, err error) error {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if !info.IsDir() {
|
if !info.IsDir() {
|
||||||
if *upload.include != "" {
|
if *upload.include != "" {
|
||||||
|
@ -108,12 +108,21 @@ func runUpload(cmd *Command, args []string) bool {
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err.Error())
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
parts, e := operation.NewFileParts(args)
|
parts, e := operation.NewFileParts(args)
|
||||||
if e != nil {
|
if e != nil {
|
||||||
fmt.Println(e.Error())
|
fmt.Println(e.Error())
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
results, err := operation.SubmitFiles(func() string { return *upload.master }, grpcDialOption, parts, *upload.replication, *upload.collection, *upload.dataCenter, *upload.ttl, *upload.diskType, *upload.maxMB, *upload.usePublicUrl)
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err.Error())
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
results, _ := operation.SubmitFiles(func() string { return *upload.master }, grpcDialOption, parts, *upload.replication, *upload.collection, *upload.dataCenter, *upload.ttl, *upload.diskType, *upload.maxMB, *upload.usePublicUrl)
|
|
||||||
bytes, _ := json.Marshal(results)
|
bytes, _ := json.Marshal(results)
|
||||||
fmt.Println(string(bytes))
|
fmt.Println(string(bytes))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue