-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
does not create empty files with -o #183
Comments
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 |
The current behavior sounds counter-intuitive to me, too. I would expect that successful download of a remote empty file results in a local empty file. |
I wouldn't mind having it create the file if it ends successfully! |
@joeyh feel like making a patch for it? |
I have proposed a patch for this on the mailing-list: http://thread.gmane.org/gmane.comp.web.curl.library/45327/focus=45328 |
I have merged the fix for this issue: a9e4674...992a731 |
... of an empty file Bug: curl#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:
joey@darkstar:
>curl -o hello http://tmp.kitenet.net/empty>cat hello% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:- 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:- 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
joey@darkstar:
cat: hello: No such file or directory
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.
The text was updated successfully, but these errors were encountered: