Skip to content

does not create empty files with -o #183

@joeyh

Description

@joeyh

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
% 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
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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions