mirror of
https://github.com/curl/curl.git
synced 2026-08-26 22:13:31 +03:00
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:
parent
7b0fd39db2
commit
08a96c6e4e
9 changed files with 93 additions and 2 deletions
|
|
@ -595,6 +595,10 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
|
|||
if(global->showerror)
|
||||
fprintf(global->errors, "curl: (%d) Failed writing body\n", result);
|
||||
}
|
||||
if(result && config->rm_partial) {
|
||||
notef(global, "Removing output file: %s", per->outfile);
|
||||
unlink(per->outfile);
|
||||
}
|
||||
}
|
||||
|
||||
/* File time can only be set _after_ the file has been closed */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue