diff --git a/Library/Homebrew/unpack_strategy/directory.rb b/Library/Homebrew/unpack_strategy/directory.rb index 5aa39e91374fe..e3bcdc122d75d 100644 --- a/Library/Homebrew/unpack_strategy/directory.rb +++ b/Library/Homebrew/unpack_strategy/directory.rb @@ -16,7 +16,9 @@ def self.can_extract?(path) def extract_to_dir(unpack_dir, basename:, verbose:) path.children.each do |child| - FileUtils.copy_entry child, unpack_dir/child.basename, true, false + system_command! "cp", + args: ["-pR", child.directory? ? "#{child}/." : child, unpack_dir/child.basename], + verbose: verbose end end end