Fix bug with printing pinned dependencies.

Brew prints this error:
```
Error: undefined method `join' for nil:NilClass
```

because, in this code:

```ruby
puts pinned_dependents.map do |f|
  "#{f.full_specified_name} #{f.pkg_version}"
end.join(", ")
```
the block is passed to `puts` and not to `map`. `.join(",")` is called on the output of `puts`.

(I think the regression was introduced in this commit: e12a7b0808353ea81d63774be1edaff81710d7a6)
This commit is contained in:
Bob Lail 2019-12-04 12:30:54 -06:00
parent 97c575b6c3
commit a26390be05

View File

@ -239,9 +239,9 @@ module Homebrew
if pinned_dependents.present?
plural = "dependent".pluralize(pinned_dependents.count)
ohai "Not upgrading #{pinned_dependents.count} pinned #{plural}:"
puts pinned_dependents.map do |f|
puts(pinned_dependents.map do |f|
"#{f.full_specified_name} #{f.pkg_version}"
end.join(", ")
end.join(", "))
end
# Print the upgradable dependents.
@ -292,9 +292,9 @@ module Homebrew
count = pinned_broken_dependents.count
plural = "dependent".pluralize(pinned_broken_dependents.count)
onoe "Not reinstalling #{count} broken and outdated, but pinned #{plural}:"
$stderr.puts pinned_broken_dependents.map do |f|
$stderr.puts(pinned_broken_dependents.map do |f|
"#{f.full_specified_name} #{f.pkg_version}"
end.join(", ")
end.join(", "))
end
# Print the broken dependents.