extend/kernel: add sigs to opoo/onoe/ofail
Add these and correctly pass through a string to `GitHub::Actions.puts_annotation_if_env_set`. Also, fix some call sites to not rely on the `void` return.
This commit is contained in:
parent
e26e673119
commit
50384591c7
@ -45,6 +45,8 @@ module Homebrew
|
|||||||
To install, run:
|
To install, run:
|
||||||
brew install --HEAD #{name}
|
brew install --HEAD #{name}
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
|
nil
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
args.named.to_latest_kegs
|
args.named.to_latest_kegs
|
||||||
|
|||||||
@ -125,6 +125,8 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
rescue => e
|
rescue => e
|
||||||
onoe e
|
onoe e
|
||||||
|
|
||||||
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
if sha256.present? && last_sha256 != sha256
|
if sha256.present? && last_sha256 != sha256
|
||||||
@ -134,6 +136,8 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
rescue Timeout::Error
|
rescue Timeout::Error
|
||||||
onoe "Timed out guessing version for cask '#{cask}'."
|
onoe "Timed out guessing version for cask '#{cask}'."
|
||||||
|
|
||||||
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
if version
|
if version
|
||||||
|
|||||||
@ -61,26 +61,29 @@ module Kernel
|
|||||||
# Print a warning message.
|
# Print a warning message.
|
||||||
#
|
#
|
||||||
# @api public
|
# @api public
|
||||||
|
sig { params(message: T.any(String, Exception)).void }
|
||||||
def opoo(message)
|
def opoo(message)
|
||||||
Tty.with($stderr) do |stderr|
|
Tty.with($stderr) do |stderr|
|
||||||
stderr.puts Formatter.warning(message, label: "Warning")
|
stderr.puts Formatter.warning(message, label: "Warning")
|
||||||
GitHub::Actions.puts_annotation_if_env_set(:warning, message)
|
GitHub::Actions.puts_annotation_if_env_set(:warning, message.to_s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Print an error message.
|
# Print an error message.
|
||||||
#
|
#
|
||||||
# @api public
|
# @api public
|
||||||
|
sig { params(message: T.any(String, Exception)).void }
|
||||||
def onoe(message)
|
def onoe(message)
|
||||||
Tty.with($stderr) do |stderr|
|
Tty.with($stderr) do |stderr|
|
||||||
stderr.puts Formatter.error(message, label: "Error")
|
stderr.puts Formatter.error(message, label: "Error")
|
||||||
GitHub::Actions.puts_annotation_if_env_set(:error, message)
|
GitHub::Actions.puts_annotation_if_env_set(:error, message.to_s)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Print an error message and fail at the end of the program.
|
# Print an error message and fail at the end of the program.
|
||||||
#
|
#
|
||||||
# @api public
|
# @api public
|
||||||
|
sig { params(error: T.any(String, Exception)).void }
|
||||||
def ofail(error)
|
def ofail(error)
|
||||||
onoe error
|
onoe error
|
||||||
Homebrew.failed = true
|
Homebrew.failed = true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user