From 23306ab434afc185e22a0f357a27e8da687620af Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 12 Jul 2016 19:46:29 +0100 Subject: github: produce better curl error messages. (#441) * global: add RUBY_TWO global variable. * test-bot: use RUBY_TWO global variable. * github: produce better curl error messages. If we don't know why curl has failed then ensure that the error messages that it produced are included as part of the user output. --- Library/Homebrew/utils/curl.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'Library/Homebrew/utils/curl.rb') diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index a1653d46c..db3534542 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -1,4 +1,5 @@ require "pathname" +require "open3" def curl_args(extra_args=[]) curl = Pathname.new ENV["HOMEBREW_CURL"] @@ -19,6 +20,15 @@ def curl(*args) end def curl_output(*args) - curl_args = curl_args(args) - ["--fail"] - Utils.popen_read_text(*curl_args) + curl_args = curl_args(args) + curl_args -= ["--fail"] + if RUBY_TWO + curl_args -= ["--silent"] + Open3.popen3(*curl_args) do |_, stdout, stderr, wait_thread| + [stdout.read, stderr.read, wait_thread.value] + end + else + output = Utils.popen_read_text(*curl_args) + [output, nil, $?] + end end -- cgit v1.2.3