Retry with ditto when “End-of-central-directory signature not found.”.

This commit is contained in:
Markus Reiter 2019-03-29 21:06:39 +01:00
parent e767ce642c
commit 62a0c2fed9
2 changed files with 14 additions and 1 deletions

View File

@ -548,6 +548,10 @@ class ErrorDuringExecution < RuntimeError
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.

View File

@ -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")