From cb537eae52a35eb644e12a7af74d810776312488 Mon Sep 17 00:00:00 2001 From: Sam Ford <1584702+samford@users.noreply.github.com> Date: Thu, 30 Dec 2021 16:07:29 -0500 Subject: [PATCH] Strategy: Add --silent flag to DEFAULT_CURL_ARGS Currently, only `Livecheck::Strategy::PAGE_HEADERS_CURL_ARGS` uses the `--silent` option and `PAGE_CONTENT_CURL_ARGS` does not (though there's no intention behind this omission). However, the `#page_content` method should also use the `--silent` flag, to prevent progress bar text (`#=#=#`, etc.) from appearing in output. This is an issue because the regex that's used to identify `curl` error messages in `stderr` (`^curl:.+$/`) will fail if leading progress bar text is present. This leads to an ambiguous "cURL failed without a detectable error" message instead of the actual error message(s) from `curl`. This commit addresses the issue by adding `--silent` to `Livecheck::Strategy::DEFAULT_CURL_ARGS`, which both `PAGE_HEADERS_CURL_ARGS` and `PAGE_CONTENT_CURL_ARGS` inherit. --- Library/Homebrew/livecheck/strategy.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/livecheck/strategy.rb b/Library/Homebrew/livecheck/strategy.rb index c5ff3b9d51..3731107461 100644 --- a/Library/Homebrew/livecheck/strategy.rb +++ b/Library/Homebrew/livecheck/strategy.rb @@ -39,6 +39,9 @@ module Homebrew DEFAULT_CURL_ARGS = [ # Follow redirections to handle mirrors, relocations, etc. "--location", + # Avoid progress bar text, so we can reliably identify `curl` error + # messages in output + "--silent", ].freeze # `curl` arguments used in `Strategy#page_headers` method. @@ -46,8 +49,7 @@ module Homebrew # We only need the response head (not the body) "--head", # Some servers may not allow a HEAD request, so we use GET - "--request", "GET", - "--silent" + "--request", "GET" ] + DEFAULT_CURL_ARGS).freeze # `curl` arguments used in `Strategy#page_content` method.