Strategy: Improve curl error message finding

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`.
This commit is contained in:
Sam Ford 2021-08-25 11:58:28 -04:00
parent f0dbd8d9a5
commit 6b66ec9e62
No known key found for this signature in database
GPG Key ID: 95209E46C7FFDEFE

View File

@ -247,10 +247,8 @@ module Homebrew
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`