From 2056e24a12a48b9776e78992cfe77494d64ca3f8 Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Mon, 30 Jul 2012 23:20:05 -0300 Subject: [PATCH] mdfind: Handle multiple results Turns out mdfind can return multiple results on the commandline, if more than one app bundle matches. Fixes Homebrew/homebrew#13789. --- Library/Homebrew/macos.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/macos.rb b/Library/Homebrew/macos.rb index 80f8b3d2d2..0441c26f29 100644 --- a/Library/Homebrew/macos.rb +++ b/Library/Homebrew/macos.rb @@ -269,7 +269,7 @@ module MacOS extend self end def mdfind attribute, id - path = `mdfind "#{attribute} == '#{id}'"`.strip + path = `mdfind "#{attribute} == '#{id}'"`.split("\n").first.strip Pathname.new(path) unless path.empty? end