aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/exceptions.rb14
-rw-r--r--Library/Homebrew/utils.rb7
2 files changed, 20 insertions, 1 deletions
diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb
index 72c62dcc7..e77c0573a 100644
--- a/Library/Homebrew/exceptions.rb
+++ b/Library/Homebrew/exceptions.rb
@@ -112,3 +112,17 @@ class BuildError < Homebrew::InstallationError
@command == './configure'
end
end
+
+class DownloadError < RuntimeError
+ attr :command
+ attr :args
+ attr :exit_status
+
+ def initialize cmd, args, status
+ @command = cmd
+ @args = args
+ args.map!{ |arg| arg.to_s.gsub " ", "\\ " }
+ super "#{cmd} #{args.join ' '}\nDownloader failed with exit status #{status}"
+ @exit_status = status
+ end
+end
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 5ce54e6fc..485995615 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -1,4 +1,5 @@
require 'pathname'
+require 'exceptions'
class Tty
class <<self
@@ -104,10 +105,14 @@ def quiet_system cmd, *args
end
def curl *args
+ curl = Pathname.new '/usr/bin/curl'
+ raise "#{curl} is not an executable!" unless curl.exist? and curl.executable?
+
+ args = [HOMEBREW_CURL_ARGS, HOMEBREW_USER_AGENT, *args]
# See https://github.com/mxcl/homebrew/issues/6103
args << "--insecure" if MacOS.version < 10.6
- safe_system '/usr/bin/curl', HOMEBREW_CURL_ARGS, HOMEBREW_USER_AGENT, *args unless args.empty?
+ raise DownloadError.new curl, args, $? unless Homebrew.system curl, *args
end
def puts_columns items, star_items=[]