parent
ad27b21cd1
commit
2d8a3ac35a
@ -63,7 +63,7 @@ module Homebrew
|
||||
end
|
||||
|
||||
# Use strings to search through the file for each string
|
||||
IO.popen("strings -t x - '#{file}'", "rb") do |io|
|
||||
Utils.popen_read("strings", "-t", "x", "-", file.to_s) do |io|
|
||||
until io.eof?
|
||||
str = io.readline.chomp
|
||||
|
||||
@ -168,8 +168,8 @@ module Homebrew
|
||||
prefix_check = HOMEBREW_PREFIX
|
||||
end
|
||||
|
||||
relocatable = !keg_contains(prefix_check, keg)
|
||||
relocatable = !keg_contains(HOMEBREW_CELLAR, keg) && relocatable
|
||||
relocatable = !keg_contains(prefix_check.to_s, keg)
|
||||
relocatable = !keg_contains(HOMEBREW_CELLAR.to_s, keg) && relocatable
|
||||
puts if !relocatable && ARGV.verbose?
|
||||
rescue Interrupt
|
||||
ignore_interrupts { bottle_path.unlink if bottle_path.exist? }
|
||||
|
||||
@ -27,7 +27,7 @@ class Volumes
|
||||
def get_mounts path=nil
|
||||
vols = []
|
||||
# get the volume of path, if path is nil returns all volumes
|
||||
raw_df = IO.popen("/bin/df -P #{path}", "rb", &:read)
|
||||
raw_df = Utils.popen_read("/bin/df", "-P", path, &:read)
|
||||
raw_df.split("\n").each do |line|
|
||||
case line
|
||||
# regex matches: /dev/disk0s2 489562928 440803616 48247312 91% /
|
||||
|
||||
@ -144,7 +144,7 @@ class CurlDownloadStrategy < AbstractDownloadStrategy
|
||||
def buffered_write(tool)
|
||||
target = File.basename(basename_without_params, tarball_path.extname)
|
||||
|
||||
IO.popen("#{tool} -f '#{tarball_path}' -c", "rb") do |pipe|
|
||||
Utils.popen_read(tool, "-f", tarball_path.to_s, "-c") do |pipe|
|
||||
File.open(target, "wb") do |f|
|
||||
buf = ""
|
||||
f.write(buf) while pipe.read(1024, buf)
|
||||
|
||||
@ -39,7 +39,7 @@ class FormulaVersions
|
||||
|
||||
def rev_list(branch="HEAD")
|
||||
repository.cd do
|
||||
IO.popen("git rev-list --abbrev-commit --remove-empty #{branch} -- #{entry_name}") do |io|
|
||||
Utils.popen_read("git", "rev-list", "--abbrev-commit", "--remove-empty", branch, "--", entry_name) do |io|
|
||||
yield io.readline.chomp until io.eof?
|
||||
end
|
||||
end
|
||||
|
||||
@ -86,7 +86,7 @@ class Keg
|
||||
end
|
||||
|
||||
def each_unique_file_matching string
|
||||
IO.popen("/usr/bin/fgrep -lr '#{string}' '#{self}' 2>/dev/null", "rb") do |io|
|
||||
Utils.popen_read("/usr/bin/fgrep", "-lr", string, to_s) do |io|
|
||||
hardlinks = Set.new
|
||||
|
||||
until io.eof?
|
||||
|
||||
@ -140,10 +140,7 @@ module MacCPUs
|
||||
|
||||
def sysctl_bool(property)
|
||||
(@properties ||= {}).fetch(property) do
|
||||
result = nil
|
||||
IO.popen("/usr/sbin/sysctl -n '#{property}' 2>/dev/null") do |f|
|
||||
result = f.gets.to_i # should be 0 or 1
|
||||
end
|
||||
result = Utils.popen_read("/usr/sbin/sysctl", "-n", property, &:gets).to_i
|
||||
# sysctl call succeded and printed 1
|
||||
@properties[property] = $?.success? && result == 1
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user