blob: 68474c9760f5b4a3f910c17d1ce4e4a5ea3e7f01 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
require "pathname"
require "open3"
def curl_args(extra_args=[])
curl = Pathname.new ENV["HOMEBREW_CURL"]
curl = Pathname.new "/usr/bin/curl" unless curl.exist?
raise "#{curl} is not executable" unless curl.exist? && curl.executable?
flags = HOMEBREW_CURL_ARGS
flags -= ["--progress-bar"] if ARGV.verbose?
args = ["#{curl}"] + flags + extra_args
args << "--verbose" if ENV["HOMEBREW_CURL_VERBOSE"]
args << "--silent" if !$stdout.tty? || ENV["TRAVIS"]
args
end
def curl(*args)
safe_system(*curl_args(args))
end
def curl_output(*args)
curl_args = curl_args(args)
curl_args -= ["--fail", "--silent"]
Open3.popen3(*curl_args) do |_, stdout, stderr, wait_thread|
[stdout.read, stderr.read, wait_thread.value]
end
end
|