From 5718e87e5e5e64d9b45cc97c8a5bb667a0627c3c Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Fri, 22 Aug 2025 12:54:26 +0100 Subject: [PATCH] cmd/upgrade: fix ofail/opoo call. This method doesn't exist on `Kernel` any more. While we're here, let's avoid `public_send` and use `if` instead for a bit more safety. --- Library/Homebrew/cmd/upgrade.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb index 91e88eec44..7af25d3876 100644 --- a/Library/Homebrew/cmd/upgrade.rb +++ b/Library/Homebrew/cmd/upgrade.rb @@ -196,10 +196,13 @@ module Homebrew end if pinned.any? - Kernel.public_send( - formulae.any? ? :ofail : :opoo, # only fail when pinned formulae are named explicitly - "Not upgrading #{pinned.count} pinned #{Utils.pluralize("package", pinned.count)}:", - ) + message = "Not upgrading #{pinned.count} pinned #{Utils.pluralize("package", pinned.count)}:" + # only fail when pinned formulae are named explicitly + if formulae.any? + ofail message + else + opoo message + end puts pinned.map { |f| "#{f.full_specified_name} #{f.pkg_version}" } * ", " end