forked from TrueCloudLab/rclone
cmd/copyurl: fix checking of --dry-run
This commit is contained in:
parent
733b072d4f
commit
2d2533a08a
1 changed files with 8 additions and 0 deletions
|
@ -1337,6 +1337,14 @@ func RcatSize(fdst fs.Fs, dstFileName string, in io.ReadCloser, size int64, modT
|
||||||
accounting.Stats.Transferring(dstFileName)
|
accounting.Stats.Transferring(dstFileName)
|
||||||
body := ioutil.NopCloser(in) // we let the server close the body
|
body := ioutil.NopCloser(in) // we let the server close the body
|
||||||
in := accounting.NewAccountSizeName(body, size, dstFileName) // account the transfer (no buffering)
|
in := accounting.NewAccountSizeName(body, size, dstFileName) // account the transfer (no buffering)
|
||||||
|
|
||||||
|
if fs.Config.DryRun {
|
||||||
|
fs.Logf("stdin", "Not uploading as --dry-run")
|
||||||
|
// prevents "broken pipe" errors
|
||||||
|
_, err = io.Copy(ioutil.Discard, in)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
defer func() {
|
defer func() {
|
||||||
closeErr := in.Close()
|
closeErr := in.Close()
|
||||||
|
|
Loading…
Reference in a new issue