Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
does not create empty files with -o #183
I'd expect curl -o to always create the specified file, if the url download succeeded. This consistency means it's easy to use it in a script; run curl, check its exit status and if it succeeded, the url content is there in the file to be used. And it just seems to make sense. But, reality is different when downloading an url that happens to be empty:
This behavior is not documented on the man page either. So you have either a behavior bug (IMHO) or at least a documentation bug.
I'm using curl 7.38.0.
It certainly works like this on purpose, it is not a mistake. The documentation should probably be clarified to make this less surprising.
The idea is to not create a file in case of errors so it creates the file on demand when the first data arrives. But if no data ever arrives...
Daniel Stenberg wrote:
Seems like you could create the file once the data transfer is complete,
see shy jo