No spurious error due to Interrupt during curl
Only delete the file that is downloaded if an error occurs while downloading it.
This commit is contained in:
parent
680e201923
commit
de620e4396
@ -1,9 +1,7 @@
|
||||
# This script contains bash completions for brew.
|
||||
#
|
||||
# To use, edit your .bashrc and add the line:
|
||||
# source `brew --prefix`/Library/Contributions/brew_bash_completion.sh
|
||||
#
|
||||
# Assuming you have brew installed in /usr/local, then you'll want:
|
||||
# source /usr/local/Library/Contributions/brew_bash_completion.sh
|
||||
|
||||
_brew_to_completion()
|
||||
{
|
||||
|
||||
@ -37,14 +37,16 @@ class HttpDownloadStrategy <AbstractDownloadStrategy
|
||||
@dl=HOMEBREW_CACHE+File.basename(@url)
|
||||
end
|
||||
unless @dl.exist?
|
||||
curl @url, '-o', @dl
|
||||
begin
|
||||
curl @url, '-o', @dl
|
||||
rescue
|
||||
@dl.unlink
|
||||
raise
|
||||
end
|
||||
else
|
||||
puts "File already downloaded and cached"
|
||||
end
|
||||
return @dl # thus performs checksum verification
|
||||
rescue Exception
|
||||
@dl.unlink
|
||||
raise "There was an error downloading the file:\n#{@url}"
|
||||
end
|
||||
def stage
|
||||
case `file -b #{@dl}`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user