Skip to content

Commit

Permalink
Honor homebrew curlrc config for analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme committed Aug 9, 2024
1 parent 8744032 commit b6b75bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Library/Homebrew/utils/analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,13 @@ def deferred_curl(url, args)
require "utils/curl"

curl = Utils::Curl.curl_executable
args = Utils::Curl.curl_args(*args, show_output: false, show_error: false)

Check warning on line 57 in Library/Homebrew/utils/analytics.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/utils/analytics.rb#L57

Added line #L57 was not covered by tests
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

Check warning on line 63 in Library/Homebrew/utils/analytics.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/utils/analytics.rb#L63

Added line #L63 was not covered by tests
end
Process.detach T.must(pid)
end
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/utils/curl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def clear_path_cache
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,
Expand Down Expand Up @@ -129,7 +129,7 @@ def curl_args(

args << "--referer" << referer if referer.present?

args + extra_args
(args + extra_args).map(&:to_s)
end

def curl_with_workarounds(
Expand Down

0 comments on commit b6b75bb

Please sign in to comment.