Merge pull request #5954 from reitermarkus/ditto

Retry with `ditto` when “End-of-central-directory signature not found.”.
This commit is contained in:
Markus Reiter 2019-04-02 14:38:37 +02:00 committed by GitHub
commit 11e5dd9904
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -548,6 +548,10 @@ class ErrorDuringExecution < RuntimeError
super s super s
end end
def stderr
[*output].select { |type,| type == :stderr }.map(&:last).join
end
end end
# Raised by {Pathname#verify_checksum} when "expected" is nil or empty. # Raised by {Pathname#verify_checksum} when "expected" is nil or empty.

View File

@ -2,7 +2,16 @@ module UnpackStrategy
class Zip class Zip
prepend Module.new { prepend Module.new {
def extract_to_dir(unpack_dir, basename:, verbose:) 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 volumes = result.stderr.chomp
.split("\n") .split("\n")