formula_assertions: Fix type of cmd param in shell_output

- This can be either a String or a Pathname, per
  the part of the `noseyparker` test that failed
  (in a different part of the test, the command is
  passed as a string).

```
  ==> Testing noseyparker
  ==> /opt/homebrew/Cellar/noseyparker/0.18.1/bin/noseyparker -V
  Error: noseyparker: failed
  An exception occurred within a child process:
    TypeError: Parameter 'cmd': Expected type String, got type Pathname with value #<Pathname:/opt/homebrew/Ce...ps://github.com/Homebrew/brew>
  Caller: /opt/homebrew/Library/Taps/homebrew/homebrew-core/Formula/n/noseyparker.rb:35
```
This commit is contained in:
Issy Long 2024-07-12 16:28:35 -04:00
parent 868c3dc9cd
commit ecdd45e73e
No known key found for this signature in database

View File

@ -21,7 +21,7 @@ module Homebrew
# Returns the output of running cmd and asserts the exit status.
#
# @api public
sig { params(cmd: String, result: Integer).returns(String) }
sig { params(cmd: T.any(Pathname, String), result: Integer).returns(String) }
def shell_output(cmd, result = 0)
ohai cmd
output = `#{cmd}`