-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Avoid creating files when download fails #21071
Conversation
without -v, doesn't -f suppress failure output? |
Appears the same to me Old version: julia> download("http://httpbin.org/status/404")
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
"/var/folders/0k/c9cpsq_x02x_j4bxj3mtx1_r0000gn/T/juliaK0MJjD"
julia> download("http://127.0.0.1/") # No webserver running
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused
ERROR: failed process: Process(`curl -o /var/folders/0k/c9cpsq_x02x_j4bxj3mtx1_r0000gn/T/juliaJAHHn1 -L http://127.0.0.1/`, ProcessExited(7)) [7]
in pipeline_error(::Base.Process) at ./process.jl:616
in run(::Cmd) at ./process.jl:592
in download(::String, ::String) at ./interactiveutil.jl:527
in download(::String) at ./interactiveutil.jl:538 PR version: julia> download("http://httpbin.org/status/404")
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (22) The requested URL returned error: 404 NOT FOUND
ERROR: failed process: Process(`curl -L -f -o /var/folders/0k/c9cpsq_x02x_j4bxj3mtx1_r0000gn/T/juliaudH6LF http://httpbin.org/status/404`, ProcessExited(22)) [22]
Stacktrace:
[1] pipeline_error(::Base.Process) at ./process.jl:687
[2] run(::Cmd) at ./process.jl:656
[3] download(::String, ::String) at ./interactiveutil.jl:597
[4] download(::String) at ./interactiveutil.jl:608
julia> download("http://127.0.0.1")
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (7) Failed to connect to 127.0.0.1 port 80: Connection refused
ERROR: failed process: Process(`curl -L -f -o /var/folders/0k/c9cpsq_x02x_j4bxj3mtx1_r0000gn/T/juliamFBy7X http://127.0.0.1`, ProcessExited(7)) [7]
Stacktrace:
[1] pipeline_error(::Base.Process) at ./process.jl:687
[2] run(::Cmd) at ./process.jl:656
[3] download(::String, ::String) at ./interactiveutil.jl:597
[4] download(::String) at ./interactiveutil.jl:608 |
I could make some tests using "http://httpbin.org". Where should I put these tests? |
probably a new file that doesn't run by default, but can be manually run on CI like with libgit2-online and pkg |
I've been unable to determine if |
test/download.jl
Outdated
@@ -0,0 +1,20 @@ | |||
# This file is a part of Julia. License is MIT: http://julialang.org/license | |||
|
|||
@testset "download" begin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't add the testset here, that's just noise in the output
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will remove. I was looking at libgit2-online.jl
which does this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I just deleted that
Tests on Travis CI Linux have found an issue. |
Attempting to debug Travis CI Linux issues. I'm unable to reproduce the issue locally so I'll be testing against Travis. |
29c73f7
to
2488ae4
Compare
09aa102
to
decead1
Compare
Worked through the issue. When downloading an empty file Travis CI Linux uses Curl 7.22.0 which doesn't bother to create an empty file. Newer versions of Curl (like 7.43.0 on Travis CI Mac) do create the empty file (curl/curl#183). Additionally, Window's version of The test now is now indifferent as to whether downloading an empty file will or will not create a file. |
Code is ready to be merged. Let me know if it needs additional changes. |
@iblis17 or @ararslan, could you check the behavior of |
|
Note that
wget
will always create a file. We could automatically clean it up if we wrap it in atry/catch
.