From d3534c1cc2af6f2e5b2aa1511433ee9c6473957d Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Thu, 12 Jul 2018 22:14:04 +0200 Subject: [PATCH] Use `zipinfo` instead of `unzip -l`. --- Library/Homebrew/unpack_strategy.rb | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/Library/Homebrew/unpack_strategy.rb b/Library/Homebrew/unpack_strategy.rb index 3e1d582d52..f360296503 100644 --- a/Library/Homebrew/unpack_strategy.rb +++ b/Library/Homebrew/unpack_strategy.rb @@ -92,17 +92,8 @@ class JarUnpackStrategy < UncompressedUnpackStrategy return false unless ZipUnpackStrategy.can_extract?(path: path, magic_number: magic_number) # Check further if the ZIP is a JAR/WAR. - Open3.popen3("unzip", "-l", path) do |stdin, stdout, stderr, wait_thr| - stdin.close_write - stderr.close_read - - begin - return stdout.each_line.any? { |l| l.match?(%r{\s+META-INF/MANIFEST.MF$}) } - ensure - stdout.close_read - wait_thr.kill - end - end + out, _, status = Open3.capture3("zipinfo", "-1", path) + status.success? && out.split("\n").include?("META-INF/MANIFEST.MF") end end