Merge pull request #1258 from jawshooah/perf/keg-batch-text-files
keg_relocate: run /usr/bin/file in batches
This commit is contained in:
commit
af78b64d5c
@ -72,13 +72,14 @@ class Keg
|
|||||||
# file with that fix is only available in macOS Sierra.
|
# file with that fix is only available in macOS Sierra.
|
||||||
# http://bugs.gw.com/view.php?id=292
|
# http://bugs.gw.com/view.php?id=292
|
||||||
with_custom_locale("C") do
|
with_custom_locale("C") do
|
||||||
path.find do |pn|
|
files = path.find.reject { |pn|
|
||||||
next if pn.symlink? || pn.directory?
|
pn.symlink? || pn.directory? || Metafiles::EXTENSIONS.include?(pn.extname)
|
||||||
next if Metafiles::EXTENSIONS.include? pn.extname
|
}
|
||||||
if Utils.popen_read("/usr/bin/file", "--brief", pn).include?("text") ||
|
output, _status = Open3.capture2("/usr/bin/xargs -0 /usr/bin/file --no-dereference --brief",
|
||||||
pn.text_executable?
|
stdin_data: files.join("\0"))
|
||||||
text_files << pn
|
output.each_line.with_index do |line, i|
|
||||||
end
|
next unless line.include?("text")
|
||||||
|
text_files << files[i]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user