utils/analytics: use curl shim

This commit is contained in:
Bo Anderson 2022-05-30 04:20:53 +01:00
parent 0a1762bd14
commit a10b16828f
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65

View File

@ -47,18 +47,19 @@ module Utils
args << "--data" << "#{key}=#{value}"
end
curl = Utils::Curl.curl_executable
# Send analytics. Don't send or store any personally identifiable information.
# https://docs.brew.sh/Analytics
# https://developers.google.com/analytics/devguides/collection/protocol/v1/devguide
# https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters
if ENV["HOMEBREW_ANALYTICS_DEBUG"]
url = "https://www.google-analytics.com/debug/collect"
puts "#{ENV["HOMEBREW_CURL"]} #{args.join(" ")} #{url}"
puts Utils.popen_read ENV["HOMEBREW_CURL"], *args, url
puts "#{curl} #{args.join(" ")} #{url}"
puts Utils.popen_read(curl, *args, url)
else
pid = fork do
exec ENV["HOMEBREW_CURL"],
*args,
exec curl, *args,
"--silent", "--output", "/dev/null",
"https://www.google-analytics.com/collect"
end