Skip to content

Commit

Permalink
Strategy: Improve curl error message finding
Browse files Browse the repository at this point in the history
The existing regex wasn't able to match errors like:
  curl: option --something: is unknown

Additionally, the existing approach wouldn't capture multi-line
errors, whereas this captures all the `curl:` lines from `stderr`.
  • Loading branch information
samford committed Sep 7, 2021
1 parent f0dbd8d commit 6b66ec9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Library/Homebrew/livecheck/strategy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,8 @@ def self.page_content(url)
return data
end

/^(?<error_msg>curl: \(\d+\) .+)/ =~ stderr
{
messages: [error_msg.presence || "cURL failed without an error"],
}
error_msgs = stderr&.scan(/^curl:.+$/)
{ messages: error_msgs.presence || ["cURL failed without a detectable error"] }
end

# Handles the return value from a `strategy` block in a `livecheck`
Expand Down

0 comments on commit 6b66ec9

Please sign in to comment.