diff options
| author | Dominyk Tiller | 2016-08-02 03:11:27 +0100 |
|---|---|---|
| committer | Dominyk Tiller | 2016-08-02 03:50:50 +0100 |
| commit | 604f4b6a0785e0295e548e6d033823303da19061 (patch) | |
| tree | b0a064f9ac80d56aa34a8b140cd5bbb67be23d71 /Library | |
| parent | 196a6946e1bfe83d745097a01860a8089cfa974c (diff) | |
| download | brew-604f4b6a0785e0295e548e6d033823303da19061.tar.bz2 | |
keg_relocate: refactor path.find change for performance
Closes #616.
Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/keg_relocate.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Library/Homebrew/keg_relocate.rb b/Library/Homebrew/keg_relocate.rb index 19e452b8f..864e2f97b 100644 --- a/Library/Homebrew/keg_relocate.rb +++ b/Library/Homebrew/keg_relocate.rb @@ -64,12 +64,14 @@ class Keg text_files = [] return text_files unless File.exist?("/usr/bin/file") - path.find do |pn| - next if pn.symlink? || pn.directory? - next if Metafiles::EXTENSIONS.include? pn.extname - # File has known issues with reading files on other locales. - # http://bugs.gw.com/view.php?id=292 - with_custom_locale("C") do + # file has known issues with reading files on other locales. Has + # been fixed upstream for some time, but a sufficiently new enough + # file with that fix is only available in macOS Sierra. + # http://bugs.gw.com/view.php?id=292 + with_custom_locale("C") do + path.find do |pn| + next if pn.symlink? || pn.directory? + next if Metafiles::EXTENSIONS.include? pn.extname if Utils.popen_read("/usr/bin/file", "--brief", pn).include?("text") || pn.text_executable? text_files << pn |
