Skip to content

Commit

Permalink
JariBakken: Don't try to unpack failed Gecko downloads.
Browse files Browse the repository at this point in the history
r13222
  • Loading branch information
jarib committed Aug 3, 2011
1 parent 6b846f4 commit 662abf5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions rake-tasks/downloader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
require "uri"

class Downloader
class Error < StandardError; end

CL_RESET = Platform.windows? ? '' : "\r\e[0K"

def self.fetch(source_url, destination_path = nil)
Expand All @@ -25,7 +27,7 @@ def initialize(source, destination)
end

def download!
Net::HTTP.get_response(@url) do |response|
response = Net::HTTP.get_response(@url) do |response|
total = response.content_length
progress = 0
segment_count = 0
Expand All @@ -43,6 +45,10 @@ def download!
end
end

unless response.kind_of? Net::HTTPSuccess
raise Error, "#{response.code} for #{@url}"
end

complete_progress
end

Expand All @@ -55,6 +61,6 @@ def report_progress(progress, total)
end

def complete_progress
print CL_RESET
puts CL_RESET
end
end
2 changes: 1 addition & 1 deletion rake-tasks/gecko_sdks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def define_rule(path, url)
mv File.join(destination, "xulrunner-sdk"), path
rescue StandardError, Timeout::Error => ex
# ignore errors - dependant targets will fall back to prebuilts
$stderr.puts "Failed to download the Gecko 2 SDK - manually delete #{path} to retry."
$stderr.puts "Failed to download the Gecko 2 SDK - manually delete #{path} to retry. (#{ex.inspect})"

next
ensure
Expand Down

0 comments on commit 662abf5

Please sign in to comment.