Fix downloads directory not being created.

This commit is contained in:
Markus Reiter 2018-09-05 00:38:19 +02:00
parent beb6656278
commit 2ca3439ada
2 changed files with 5 additions and 4 deletions

View File

@ -292,6 +292,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
raise CurlDownloadStrategyError, url
end
ignore_interrupts do
cached_location.dirname.mkpath
temporary_path.rename(cached_location)
symlink_location.dirname.mkpath
end
@ -347,8 +348,6 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
end
def _fetch(url:, resolved_url:)
temporary_path.dirname.mkpath
ohai "Downloading from #{resolved_url}" if url != resolved_url
if ENV["HOMEBREW_NO_INSECURE_REDIRECT"] &&

View File

@ -47,8 +47,10 @@ def curl(*args)
end
def curl_download(*args, to: nil, continue_at: "-", **options)
had_incomplete_download ||= File.exist?(to)
curl("--location", "--remote-time", "--continue-at", continue_at.to_s, "--output", to, *args, **options)
destination = Pathname(to)
had_incomplete_download ||= destination.exist?
destination.dirname.mkpath
curl("--location", "--remote-time", "--continue-at", continue_at.to_s, "--output", destination, *args, **options)
rescue ErrorDuringExecution => e
# `curl` error 33: HTTP server doesn't seem to support byte ranges. Cannot resume.
# HTTP status 416: Requested range not satisfiable