pipe_output optional result assertion added
Closes Homebrew/homebrew#36024. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
parent
3a3f56e9a3
commit
8b793c6ab3
@ -31,14 +31,17 @@ module Homebrew
|
||||
output
|
||||
end
|
||||
|
||||
# Returns the output of running the cmd, with the optional input
|
||||
def pipe_output(cmd, input=nil)
|
||||
# Returns the output of running the cmd with the optional input, and
|
||||
# optionally asserts the exit status
|
||||
def pipe_output(cmd, input=nil, result=nil)
|
||||
ohai cmd
|
||||
IO.popen(cmd, "w+") do |pipe|
|
||||
output = IO.popen(cmd, "w+") do |pipe|
|
||||
pipe.write(input) unless input.nil?
|
||||
pipe.close_write
|
||||
pipe.read
|
||||
end
|
||||
assert_equal result, $?.exitstatus unless result.nil?
|
||||
output
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user