Merge pull request #20345 from Homebrew/assertions-typecheck
formula_assertions: fix typechecking error in `{shell,pipe}_output`
This commit is contained in:
commit
f5bddacf0c
@ -26,7 +26,8 @@ module Homebrew
|
||||
# @api public
|
||||
sig { params(cmd: T.any(Pathname, String), result: Integer).returns(String) }
|
||||
def shell_output(cmd, result = 0)
|
||||
ohai cmd
|
||||
ohai cmd.to_s
|
||||
assert_path_exists cmd, "Pathname '#{cmd}' does not exist!" if cmd.is_a?(Pathname)
|
||||
output = `#{cmd}`
|
||||
assert_equal result, $CHILD_STATUS.exitstatus
|
||||
output
|
||||
@ -41,7 +42,8 @@ module Homebrew
|
||||
# @api public
|
||||
sig { params(cmd: T.any(String, Pathname), input: T.nilable(String), result: T.nilable(Integer)).returns(String) }
|
||||
def pipe_output(cmd, input = nil, result = nil)
|
||||
ohai cmd
|
||||
ohai cmd.to_s
|
||||
assert_path_exists cmd, "Pathname '#{cmd}' does not exist!" if cmd.is_a?(Pathname)
|
||||
output = IO.popen(cmd, "w+") do |pipe|
|
||||
pipe.write(input) unless input.nil?
|
||||
pipe.close_write
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user