Skip to content

Commit f5bddac

Browse files
authored
Merge pull request #20345 from Homebrew/assertions-typecheck
formula_assertions: fix typechecking error in `{shell,pipe}_output`
2 parents 52de18f + 4c024ad commit f5bddac

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Library/Homebrew/formula_assertions.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ def assertions
2626
# @api public
2727
sig { params(cmd: T.any(Pathname, String), result: Integer).returns(String) }
2828
def shell_output(cmd, result = 0)
29-
ohai cmd
29+
ohai cmd.to_s
30+
assert_path_exists cmd, "Pathname '#{cmd}' does not exist!" if cmd.is_a?(Pathname)
3031
output = `#{cmd}`
3132
assert_equal result, $CHILD_STATUS.exitstatus
3233
output
@@ -41,7 +42,8 @@ def shell_output(cmd, result = 0)
4142
# @api public
4243
sig { params(cmd: T.any(String, Pathname), input: T.nilable(String), result: T.nilable(Integer)).returns(String) }
4344
def pipe_output(cmd, input = nil, result = nil)
44-
ohai cmd
45+
ohai cmd.to_s
46+
assert_path_exists cmd, "Pathname '#{cmd}' does not exist!" if cmd.is_a?(Pathname)
4547
output = IO.popen(cmd, "w+") do |pipe|
4648
pipe.write(input) unless input.nil?
4749
pipe.close_write

0 commit comments

Comments
 (0)