Merge pull request #17270 from Homebrew/fix_opoo_onoe_sigs
extend/kernel: add sigs to `opoo`/`onoe`/`ofail`
This commit is contained in:
commit
f590dadbf2
@ -45,6 +45,8 @@ module Homebrew
|
||||
To install, run:
|
||||
brew install --HEAD #{name}
|
||||
EOS
|
||||
|
||||
nil
|
||||
end
|
||||
else
|
||||
args.named.to_latest_kegs
|
||||
|
||||
@ -125,6 +125,8 @@ module Homebrew
|
||||
end
|
||||
rescue => e
|
||||
onoe e
|
||||
|
||||
nil
|
||||
end
|
||||
|
||||
if sha256.present? && last_sha256 != sha256
|
||||
@ -134,6 +136,8 @@ module Homebrew
|
||||
end
|
||||
rescue Timeout::Error
|
||||
onoe "Timed out guessing version for cask '#{cask}'."
|
||||
|
||||
nil
|
||||
end
|
||||
|
||||
if version
|
||||
|
||||
@ -61,26 +61,29 @@ module Kernel
|
||||
# Print a warning message.
|
||||
#
|
||||
# @api public
|
||||
sig { params(message: T.any(String, Exception)).void }
|
||||
def opoo(message)
|
||||
Tty.with($stderr) do |stderr|
|
||||
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
|
||||
|
||||
# Print an error message.
|
||||
#
|
||||
# @api public
|
||||
sig { params(message: T.any(String, Exception)).void }
|
||||
def onoe(message)
|
||||
Tty.with($stderr) do |stderr|
|
||||
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
|
||||
|
||||
# Print an error message and fail at the end of the program.
|
||||
#
|
||||
# @api public
|
||||
sig { params(error: T.any(String, Exception)).void }
|
||||
def ofail(error)
|
||||
onoe error
|
||||
Homebrew.failed = true
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user