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.
This commit is contained in:
Misty De Meo 2021-02-05 10:01:24 -08:00
parent 15ae53c049
commit c6dc42fd9d

View File

@ -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