aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXu Cheng2015-03-05 18:05:07 +0800
committerXu Cheng2015-03-06 22:19:24 +0800
commitc1ae255d955846556ac9221f16860f68d171a80a (patch)
tree1db685f3fc05ff8bd8a44b96ac045d6e757756ef
parent493edcf1f7f9a5e6810233ffcbd50c1c0d1823f3 (diff)
downloadhomebrew-c1ae255d955846556ac9221f16860f68d171a80a.tar.bz2
test-bot pathname: use Utils.popen_read instead of backticks
Closes #37418. Signed-off-by: Xu Cheng <xucheng@me.com>
-rw-r--r--Library/Homebrew/cmd/test-bot.rb8
-rw-r--r--Library/Homebrew/extend/pathname.rb7
2 files changed, 8 insertions, 7 deletions
diff --git a/Library/Homebrew/cmd/test-bot.rb b/Library/Homebrew/cmd/test-bot.rb
index 44672dd58..44b67574b 100644
--- a/Library/Homebrew/cmd/test-bot.rb
+++ b/Library/Homebrew/cmd/test-bot.rb
@@ -365,12 +365,12 @@ module Homebrew
end
test "brew", "uses", canonical_formula_name
- dependencies = `brew deps #{canonical_formula_name}`.split("\n")
- dependencies -= `brew list`.split("\n")
+ dependencies = Utils.popen_read("brew", "deps", canonical_formula_name).split("\n")
+ dependencies -= Utils.popen_read("brew", "list").split("\n")
unchanged_dependencies = dependencies - @formulae
changed_dependences = dependencies - unchanged_dependencies
- dependents = `brew uses --skip-build --skip-optional #{canonical_formula_name}`.split("\n")
+ dependents = Utils.popen_read("brew", "uses", "--skip-build", "--skip-optional", canonical_formula_name).split("\n")
dependents -= @formulae
dependents = dependents.map {|d| Formulary.factory(d)}
@@ -573,7 +573,7 @@ module Homebrew
non_dependencies = []
@formulae.each do |formula|
- formula_dependencies = `brew deps #{formula}`.split("\n")
+ formula_dependencies = Utils.popen_read("brew", "deps", formula).split("\n")
unchanged_dependencies = formula_dependencies - @formulae
changed_dependences = formula_dependencies - unchanged_dependencies
changed_dependences.each do |changed_formula|
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index 2ca8b6e5f..6e7a8ef58 100644
--- a/Library/Homebrew/extend/pathname.rb
+++ b/Library/Homebrew/extend/pathname.rb
@@ -413,10 +413,11 @@ class Pathname
end
def abv
- out=''
- n=`find #{to_s} -type f ! -name .DS_Store | wc -l`.to_i
+ out = ""
+ n = Utils.popen_read("find", expand_path.to_s, "-type", "f", "!", "-name", ".DS_Store").split("\n").size
out << "#{n} files, " if n > 1
- out << `/usr/bin/du -hs #{to_s} | cut -d"\t" -f1`.strip
+ out << Utils.popen_read("/usr/bin/du", "-hs", expand_path.to_s).split("\t")[0]
+ out
end
# We redefine these private methods in order to add the /o modifier to