Fix pull.

This commit is contained in:
Markus Reiter 2017-08-21 19:32:16 +02:00
parent 85fd43d4fe
commit 15e572702e
2 changed files with 4 additions and 5 deletions

View File

@ -587,7 +587,7 @@ module Homebrew
# We're in the cache; make sure to force re-download # We're in the cache; make sure to force re-download
loop do loop do
begin begin
curl_download url, to: filename curl_download url, continue_at: 0, to: filename
break break
rescue rescue
if retry_count >= max_curl_retries if retry_count >= max_curl_retries

View File

@ -37,13 +37,12 @@ def curl(*args)
safe_system(*curl_args(*args)) safe_system(*curl_args(*args))
end end
def curl_download(*args, to: nil, **options) def curl_download(*args, to: nil, continue_at: "-", **options)
continue_at ||= "-" curl("--location", "--remote-time", "--continue-at", continue_at.to_s, "--output", to, *args, **options)
curl("--location", "--remote-time", "--continue-at", continue_at, "--output", to, *args, **options)
rescue ErrorDuringExecution rescue ErrorDuringExecution
# `curl` error 33: HTTP server doesn't seem to support byte ranges. Cannot resume. # `curl` error 33: HTTP server doesn't seem to support byte ranges. Cannot resume.
if $CHILD_STATUS.exitstatus == 33 && continue_at == "-" if $CHILD_STATUS.exitstatus == 33 && continue_at == "-"
continue_at = "0" continue_at = 0
retry retry
end end