Merge pull request #20213 from Homebrew/dug-20205

Exit non-zero when pinning uninstalled formula
This commit is contained in:
Douglas Eichelberger 2025-07-04 21:56:14 +00:00 committed by GitHub
commit 43b72d3633
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -25,7 +25,7 @@ module Homebrew
if f.pinned? if f.pinned?
opoo "#{f.name} already pinned" opoo "#{f.name} already pinned"
elsif !f.pinnable? elsif !f.pinnable?
onoe "#{f.name} not installed" ofail "#{f.name} not installed"
else else
f.pin f.pin
end end

View File

@ -11,4 +11,10 @@ RSpec.describe Homebrew::Cmd::Pin do
expect { brew "pin", "testball" }.to be_a_success expect { brew "pin", "testball" }.to be_a_success
end end
it "fails with an uninstalled Formula", :integration_test do
setup_test_formula "testball"
expect { brew "pin", "testball" }.to be_a_failure
end
end end