Merge pull request #12947 from Bo98/unzip-path

unpack_strategy/zip: allow unzip formula to be used
This commit is contained in:
Bo Anderson 2022-03-02 14:08:52 +00:00 committed by GitHub
commit 3ddcaacfd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,10 +27,17 @@ module UnpackStrategy
.returns(SystemCommand::Result)
}
def extract_to_dir(unpack_dir, basename:, verbose:)
unzip = begin
Formula["unzip"]
rescue FormulaUnavailableError
nil
end
with_env(TZ: "UTC") do
quiet_flags = verbose ? [] : ["-qq"]
result = system_command! "unzip",
args: [*quiet_flags, "-o", path, "-d", unpack_dir],
env: { "PATH" => PATH.new(unzip&.opt_bin, ENV["PATH"]) },
verbose: verbose,
print_stderr: false