Skip to content

Commit

Permalink
Merge pull request #5954 from reitermarkus/ditto
Browse files Browse the repository at this point in the history
Retry with `ditto` when “End-of-central-directory signature not found.”.
  • Loading branch information
reitermarkus authored Apr 2, 2019
2 parents e767ce6 + 62a0c2f commit 11e5dd9
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 11e5dd9

Please sign in to comment.