diff options
| author | Jack Nagel | 2014-07-11 15:51:19 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-07-11 15:52:39 -0500 |
| commit | cf93f7e15901ad4493e44bfd78312aa2802a979e (patch) | |
| tree | dc21c0fdd0f08a1bf2385baced34d62ec7d1e9f6 /Library/Homebrew | |
| parent | 625d891090c5d3f1ba5f9ca0a33e72d11dafa781 (diff) | |
| download | homebrew-cf93f7e15901ad4493e44bfd78312aa2802a979e.tar.bz2 | |
Read if no block is passed to Utils.popen_read
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/os/mac.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/os/mac/xquartz.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/utils/popen.rb | 6 |
3 files changed, 8 insertions, 4 deletions
diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index 5f245b23c..e896901ed 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -231,13 +231,13 @@ module OS def mdfind(*ids) return [] unless OS.mac? (@mdfind ||= {}).fetch(ids) do - @mdfind[ids] = Utils.popen_read("/usr/bin/mdfind", mdfind_query(*ids), &:read).split("\n") + @mdfind[ids] = Utils.popen_read("/usr/bin/mdfind", mdfind_query(*ids)).split("\n") end end def pkgutil_info(id) (@pkginfo ||= {}).fetch(id) do |key| - @pkginfo[key] = Utils.popen_read("/usr/sbin/pkgutil", "--pkg-info", key, &:read).strip + @pkginfo[key] = Utils.popen_read("/usr/sbin/pkgutil", "--pkg-info", key).strip end end diff --git a/Library/Homebrew/os/mac/xquartz.rb b/Library/Homebrew/os/mac/xquartz.rb index eb30bca13..b48314699 100644 --- a/Library/Homebrew/os/mac/xquartz.rb +++ b/Library/Homebrew/os/mac/xquartz.rb @@ -57,7 +57,7 @@ module OS def version_from_mdls(path) version = Utils.popen_read( - "/usr/bin/mdls", "-raw", "-nullMarker", "", "-name", "kMDItemVersion", path.to_s, &:read + "/usr/bin/mdls", "-raw", "-nullMarker", "", "-name", "kMDItemVersion", path.to_s ).strip version unless version.empty? end 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) |
