Honor homebrew curlrc config for analytics

This commit is contained in:
なつき 2024-08-09 10:59:06 -07:00
parent 87440322e2
commit 5442a7e34f
2 changed files with 4 additions and 3 deletions

View File

@ -54,12 +54,13 @@ module Utils
require "utils/curl"
curl = Utils::Curl.curl_executable
args = Utils::Curl.curl_args(*args, "--silent", "--output", "/dev/null", show_error: false)
if ENV["HOMEBREW_ANALYTICS_DEBUG"]
puts "#{curl} #{args.join(" ")} \"#{url}\""
puts Utils.popen_read(curl, *args, url)
else
pid = fork do
exec curl, *args, "--silent", "--output", "/dev/null", url
exec curl, *args, url
end
Process.detach T.must(pid)
end

View File

@ -65,7 +65,7 @@ module Utils
show_error: T.nilable(T::Boolean),
user_agent: T.any(String, Symbol, NilClass),
referer: T.nilable(String),
).returns(T::Array[T.untyped])
).returns(T::Array[String])
}
def curl_args(
*extra_args,
@ -129,7 +129,7 @@ module Utils
args << "--referer" << referer if referer.present?
args + extra_args
(args + extra_args).map(&:to_s)
end
def curl_with_workarounds(