Use Utils.popen_read in XQuartz version codepath

This commit is contained in:
Jack Nagel 2014-07-11 15:29:26 -05:00
parent 72129668f4
commit 677cd51977
2 changed files with 5 additions and 3 deletions

View File

@ -231,13 +231,13 @@ module OS
def mdfind(*ids)
return [] unless OS.mac?
(@mdfind ||= {}).fetch(ids) do
@mdfind[ids] = `/usr/bin/mdfind "#{mdfind_query(*ids)}"`.split("\n")
@mdfind[ids] = Utils.popen_read("/usr/bin/mdfind", mdfind_query(*ids), &:read).split("\n")
end
end
def pkgutil_info(id)
(@pkginfo ||= {}).fetch(id) do |key|
@pkginfo[key] = `/usr/sbin/pkgutil --pkg-info "#{key}" 2>/dev/null`.strip
@pkginfo[key] = Utils.popen_read("/usr/sbin/pkgutil", "--pkg-info", key, &:read).strip
end
end

View File

@ -56,7 +56,9 @@ module OS
end
def version_from_mdls(path)
version = `mdls -raw -nullMarker "" -name kMDItemVersion "#{path}" 2>/dev/null`.strip
version = Utils.popen_read(
"/usr/bin/mdls", "-raw", "-nullMarker", "", "-name", "kMDItemVersion", path.to_s, &:read
).strip
version unless version.empty?
end