From 0867534f3e96000a43484ae84b86b36a08d037a1 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Wed, 31 May 2023 00:06:55 +0800 Subject: [PATCH] unpack_strategy/zip: avoid loading formulae unnecessarily If we already have `unzip` in `PATH`, let's skip trying to load the `unzip` formula. --- Library/Homebrew/unpack_strategy/zip.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/unpack_strategy/zip.rb b/Library/Homebrew/unpack_strategy/zip.rb index de7c8b532e..c4c5fd301e 100644 --- a/Library/Homebrew/unpack_strategy/zip.rb +++ b/Library/Homebrew/unpack_strategy/zip.rb @@ -23,10 +23,12 @@ module UnpackStrategy .returns(SystemCommand::Result) } def extract_to_dir(unpack_dir, basename:, verbose:) - unzip = begin - Formula["unzip"] - rescue FormulaUnavailableError - nil + unzip = if which("unzip").blank? + begin + Formula["unzip"] + rescue FormulaUnavailableError + nil + end end with_env(TZ: "UTC") do