From 6b66ec9e6249cc867c3f379debddc51daba532f2 Mon Sep 17 00:00:00 2001 From: Sam Ford <1584702+samford@users.noreply.github.com> Date: Wed, 25 Aug 2021 11:58:28 -0400 Subject: [PATCH] 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`. --- Library/Homebrew/livecheck/strategy.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/livecheck/strategy.rb b/Library/Homebrew/livecheck/strategy.rb index c65a00e68d..67f978339b 100644 --- a/Library/Homebrew/livecheck/strategy.rb +++ b/Library/Homebrew/livecheck/strategy.rb @@ -247,10 +247,8 @@ module Homebrew return data end - /^(?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`