From 7178210a71be41eb56dd238b57a6e77c29cccbf6 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Mon, 4 Feb 2013 15:00:10 -0600 Subject: [PATCH] MacOS: cache calls to mdfind --- Library/Homebrew/macos.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/macos.rb b/Library/Homebrew/macos.rb index 3d7defa6f9..05faa04127 100644 --- a/Library/Homebrew/macos.rb +++ b/Library/Homebrew/macos.rb @@ -230,7 +230,9 @@ module MacOS extend self end def mdfind id - `/usr/bin/mdfind "kMDItemCFBundleIdentifier == '#{id}'"`.split("\n") + (@mdfind ||= {}).fetch(id.to_s) do + @mdfind[id.to_s] = `/usr/bin/mdfind "kMDItemCFBundleIdentifier == '#{id}'"`.split("\n") + end end def pkgutil_info id