Skip to content

Commit 3f08c75

Browse files
authored
Merge pull request #17465 from Homebrew/list-fix
cmd/list: new fix for exit code when supplied both a cask and formula
2 parents c3c4434 + 617a8d1 commit 3f08c75

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Library/Homebrew/cmd/list.rb

+6-2
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def run
153153
system_command! "find", args: casks.map(&:caskroom_path) + find_args, print_stdout: true if casks.present?
154154
else
155155
kegs.each { |keg| PrettyListing.new keg } if kegs.present?
156-
list_casks if casks.present?
156+
Cask::List.list_casks(*casks, one: args.public_send(:"1?")) if casks.present?
157157
end
158158
end
159159
end
@@ -165,7 +165,10 @@ def filtered_list
165165
Formula.racks
166166
else
167167
racks = args.named.map { |n| Formulary.to_rack(n) }
168-
racks.select(&:exist?)
168+
racks.select do |rack|
169+
Homebrew.failed = true unless rack.exist?
170+
rack.exist?
171+
end
169172
end
170173
if args.pinned?
171174
pinned_versions = {}
@@ -191,6 +194,7 @@ def list_casks
191194
Cask::Caskroom.casks
192195
else
193196
filtered_args = args.named.dup.delete_if do |n|
197+
Homebrew.failed = true unless Cask::Caskroom.path.join(n).exist?
194198
!Cask::Caskroom.path.join(n).exist?
195199
end
196200
# NamedAargs subclasses array

0 commit comments

Comments
 (0)