Use backticks instead of popen

Using popen here breaks brew install -v due to the way
the error pipe is passed around during install.
This commit is contained in:
Adam Vandenberg 2011-03-19 09:14:59 -07:00
parent d8c2642b6d
commit 8b4645d895

View File

@ -153,7 +153,8 @@ def archs_for_command cmd
cmd = `/usr/bin/which #{cmd}` unless Pathname.new(cmd).absolute? cmd = `/usr/bin/which #{cmd}` unless Pathname.new(cmd).absolute?
cmd.gsub! ' ', '\\ ' # Escape spaces in the filename. cmd.gsub! ' ', '\\ ' # Escape spaces in the filename.
archs = IO.popen("/usr/bin/file -L #{cmd}").readlines.inject([]) do |archs, line| lines = `/usr/bin/file -L #{cmd}`
archs = lines.to_a.inject([]) do |archs, line|
case line case line
when /Mach-O (executable|dynamically linked shared library) ppc/ when /Mach-O (executable|dynamically linked shared library) ppc/
archs << :ppc7400 archs << :ppc7400