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:
parent
15ae53c049
commit
c6dc42fd9d
@ -111,15 +111,16 @@ module Kernel
|
|||||||
puts sput
|
puts sput
|
||||||
end
|
end
|
||||||
|
|
||||||
def ohai_stdout_or_stderr(message)
|
def ohai_stdout_or_stderr(message, *sput)
|
||||||
if $stdout.tty?
|
if $stdout.tty?
|
||||||
ohai(message)
|
ohai(message, *sput)
|
||||||
else
|
else
|
||||||
$stderr.puts(ohai_title(message))
|
$stderr.puts(ohai_title(message))
|
||||||
|
$stderr.puts(sput)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def puts_stdout_or_stderr(message)
|
def puts_stdout_or_stderr(*message)
|
||||||
if $stdout.tty?
|
if $stdout.tty?
|
||||||
puts(message)
|
puts(message)
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user