curl: add --remove-on-error

If a transfer returns an error, using this option makes curl remove the
leftover downloded (partial) local file before exiting.

Added test 376 to verify

Closes #8503
This commit is contained in:
Daniel Stenberg 2022-02-24 10:30:10 +01:00
parent 7b0fd39db2
commit 08a96c6e4e
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
9 changed files with 93 additions and 2 deletions

View file

@ -203,6 +203,7 @@ DPAGES = \
remote-name-all.d \
remote-name.d \
remote-time.d \
remove-on-error.d \
request-target.d \
request.d \
resolve.d \

View file

@ -0,0 +1,12 @@
Long: remove-on-error
Help: Remove output file on errors
See-also: fail
Category: curl
Example: --remove-on-error -o output $URL
Added: 7.83.0
---
When curl returns an error when told to save output in a local file, this
option removes that saved file before exiting. This prevevents curl from
leaving a partial file in the case of an error during transfer.
If the output is not a file, this option has no effect.

View file

@ -191,6 +191,7 @@
--remote-name (-O) 4.0
--remote-name-all 7.19.0
--remote-time (-R) 7.9
--remove-on-error 7.83.0
--request (-X) 6.0
--request-target 7.55.0
--resolve 7.21.3