diff options
| author | Max Howell | 2009-09-05 20:47:15 +0100 |
|---|---|---|
| committer | Max Howell | 2009-09-05 20:47:15 +0100 |
| commit | de620e439691b540822b76c361cea0c96362606b (patch) | |
| tree | be7e5c0f9a969ef3ff1ece7c7705b51850ce89f8 /Library/Homebrew | |
| parent | 680e2019233c8ed17a62ce2cb2d8308b3593d977 (diff) | |
| download | brew-de620e439691b540822b76c361cea0c96362606b.tar.bz2 | |
No spurious error due to Interrupt during curl
Only delete the file that is downloaded if an error occurs while downloading it.
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/download_strategy.rb | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 49b071a0a..2cd85f3bb 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -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}` |
