Browse Source

Return correct exitcode when `wheed upload` fails

pull/2115/head
Daniel Nagy 4 years ago
parent
commit
0e3adde47f
No known key found for this signature in database GPG Key ID: 1B8E8DCB576FB671
  1. 13
      weed/command/upload.go

13
weed/command/upload.go

@ -84,7 +84,7 @@ func runUpload(cmd *Command, args []string) bool {
if *upload.dir == "" {
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 !info.IsDir() {
if *upload.include != "" {
@ -108,12 +108,21 @@ func runUpload(cmd *Command, args []string) bool {
}
return err
})
if err != nil {
fmt.Println(err.Error())
return false;
}
} else {
parts, e := operation.NewFileParts(args)
if e != nil {
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)
fmt.Println(string(bytes))
}

Loading…
Cancel
Save