From c6dc42fd9d65ac55cfe866746792fc00ec9a89b5 Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Fri, 5 Feb 2021 10:01:24 -0800 Subject: [PATCH] Utils: fix *_stdout_or_stderr helpers Several calls to ohai and puts were directly changed into calls to these new functions, but they don't share arity or an API. The base functions allow arbitrary number of arguments, allowing for multiline printing that covers both a title and a longer message. --- Library/Homebrew/utils.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 63824dd53e..5d54123121 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -111,15 +111,16 @@ module Kernel puts sput end - def ohai_stdout_or_stderr(message) + def ohai_stdout_or_stderr(message, *sput) if $stdout.tty? - ohai(message) + ohai(message, *sput) else $stderr.puts(ohai_title(message)) + $stderr.puts(sput) end end - def puts_stdout_or_stderr(message) + def puts_stdout_or_stderr(*message) if $stdout.tty? puts(message) else