Use extend/OS mechanism for grep args
This commit is contained in:
parent
d0feae0632
commit
2f4eaf26a0
@ -131,6 +131,12 @@ class Keg
|
|||||||
mach_o_files
|
mach_o_files
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def recursive_fgrep_args
|
||||||
|
# Don't recurse into symlinks; the man page says this is the default, but
|
||||||
|
# it's wrong. -O is a BSD-grep-only option.
|
||||||
|
"-lrO"
|
||||||
|
end
|
||||||
|
|
||||||
def self.file_linked_libraries(file, string)
|
def self.file_linked_libraries(file, string)
|
||||||
# Check dynamic library linkage. Importantly, do not perform for static
|
# Check dynamic library linkage. Importantly, do not perform for static
|
||||||
# libraries, which will falsely report "linkage" to themselves.
|
# libraries, which will falsely report "linkage" to themselves.
|
||||||
|
|||||||
@ -98,13 +98,14 @@ class Keg
|
|||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def recursive_fgrep_args
|
||||||
|
# for GNU grep; overridden for BSD grep on OS X
|
||||||
|
"-lr"
|
||||||
|
end
|
||||||
|
alias generic_recursive_fgrep_args recursive_fgrep_args
|
||||||
|
|
||||||
def each_unique_file_matching(string)
|
def each_unique_file_matching(string)
|
||||||
bsd = `/usr/bin/fgrep -V`.include?("BSD grep")
|
Utils.popen_read("/usr/bin/fgrep", recursive_fgrep_args, string, to_s) do |io|
|
||||||
grep_args = "-lr"
|
|
||||||
# Don't recurse into symlinks; the man page says this is the default, but
|
|
||||||
# it's wrong.
|
|
||||||
grep_args += "O" if bsd
|
|
||||||
Utils.popen_read("/usr/bin/fgrep", grep_args, string, to_s) do |io|
|
|
||||||
hardlinks = Set.new
|
hardlinks = Set.new
|
||||||
|
|
||||||
until io.eof?
|
until io.eof?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user