Merge pull request #11264 from Bo98/unzip-tz

unpack_strategy/zip: ensure consistent timezone management
This commit is contained in:
Bo Anderson 2021-04-28 12:59:52 +01:00 committed by GitHub
commit 90f515e336
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 40 deletions

View File

@ -15,6 +15,7 @@ module UnpackStrategy
sig { override.params(unpack_dir: Pathname, basename: Pathname, verbose: T::Boolean).returns(T.untyped) }
def extract_to_dir(unpack_dir, basename:, verbose:)
with_env(TZ: "UTC") do
if merge_xattrs && contains_extended_attributes?(path)
# We use ditto directly, because dot_clean has issues if the __MACOSX
# folder has incorrect permissions.
@ -59,6 +60,7 @@ module UnpackStrategy
end
end
end
end
private

View File

@ -27,6 +27,7 @@ module UnpackStrategy
.returns(SystemCommand::Result)
}
def extract_to_dir(unpack_dir, basename:, verbose:)
with_env(TZ: "UTC") do
quiet_flags = verbose ? [] : ["-qq"]
result = system_command! "unzip",
args: [*quiet_flags, "-o", path, "-d", unpack_dir],
@ -38,6 +39,7 @@ module UnpackStrategy
result
end
end
end
end
require "extend/os/mac/unpack_strategy/zip" if OS.mac?