aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-12-14 15:43:15 -0600
committerJack Nagel2013-12-14 15:43:15 -0600
commitba2d2da51db0d1c5f8b8179fd01c0d6d9997e8d3 (patch)
tree06cd9944d9fc79904315a1d55aea81b106302a71 /Library
parentfc1d1173b4e3d050a231fcee62500a4979f1932e (diff)
downloadhomebrew-ba2d2da51db0d1c5f8b8179fd01c0d6d9997e8d3.tar.bz2
bottle: avoid keeping entire `strings` output in memory
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/bottle.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/Library/Homebrew/cmd/bottle.rb b/Library/Homebrew/cmd/bottle.rb
index 1e5ec4ba3..efdc63a1d 100644
--- a/Library/Homebrew/cmd/bottle.rb
+++ b/Library/Homebrew/cmd/bottle.rb
@@ -86,12 +86,17 @@ module Homebrew extend self
end
# Use strings to search through the file for each string
- strings = `strings -t x - "#{file}"`.split("\n").select{ |str| str.include? string }
+ IO.popen("strings -t x - '#{file}'") do |io|
+ until io.eof?
+ str = io.readline.chomp
- strings.each do |str|
- offset, match = str.split(" ", 2)
- next if linked_libraries.include? match # Don't bother reporting a string if it was found by otool
- puts " #{Tty.gray}-->#{Tty.reset} match '#{match}' at offset #{Tty.em}0x#{offset}#{Tty.reset}"
+ next unless str.include? string
+
+ offset, match = str.split(" ", 2)
+
+ next if linked_libraries.include? match # Don't bother reporting a string if it was found by otool
+ puts " #{Tty.gray}-->#{Tty.reset} match '#{match}' at offset #{Tty.em}0x#{offset}#{Tty.reset}"
+ end
end
end
puts