From cf93f7e15901ad4493e44bfd78312aa2802a979e Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Fri, 11 Jul 2014 15:51:19 -0500 Subject: Read if no block is passed to Utils.popen_read --- Library/Homebrew/utils/popen.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew/utils') diff --git a/Library/Homebrew/utils/popen.rb b/Library/Homebrew/utils/popen.rb index 83f140163..1463df530 100644 --- a/Library/Homebrew/utils/popen.rb +++ b/Library/Homebrew/utils/popen.rb @@ -10,7 +10,11 @@ module Utils def self.popen(args, mode) IO.popen("-", mode) do |pipe| if pipe - yield pipe + if block_given? + yield pipe + else + return pipe.read + end else STDERR.reopen("/dev/null", "w") exec(*args) -- cgit v1.2.3