Skip to content

Commit

Permalink
Retry with ditto when “End-of-central-directory signature not found.”.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed Apr 2, 2019
1 parent e767ce6 commit 62a0c2f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Library/Homebrew/exceptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,10 @@ def initialize(cmd, status:, output: nil)

super s
end

def stderr
[*output].select { |type,| type == :stderr }.map(&:last).join
end
end

# Raised by {Pathname#verify_checksum} when "expected" is nil or empty.
Expand Down
11 changes: 10 additions & 1 deletion Library/Homebrew/extend/os/mac/unpack_strategy/zip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@ module UnpackStrategy
class Zip
prepend Module.new {
def extract_to_dir(unpack_dir, basename:, verbose:)
result = super
result = begin
super
rescue ErrorDuringExecution => e
raise unless e.stderr.include?("End-of-central-directory signature not found.")

system_command! "ditto",
args: ["-x", "-k", path, unpack_dir],
verbose: verbose
return
end

volumes = result.stderr.chomp
.split("\n")
Expand Down

0 comments on commit 62a0c2f

Please sign in to comment.