From f97bce040fa63e0534828b4052c129e606d7551e Mon Sep 17 00:00:00 2001 From: JBYoshi <12983479+JBYoshi@users.noreply.github.com> Date: Mon, 24 Apr 2023 10:50:01 -0500 Subject: [PATCH] Update for feedback. --- .../Homebrew/cask/artifact/abstract_uninstall.rb | 2 +- Library/Homebrew/cask/artifact/moved.rb | 4 ++-- Library/Homebrew/cask/quarantine.rb | 15 +++++++-------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Library/Homebrew/cask/artifact/abstract_uninstall.rb b/Library/Homebrew/cask/artifact/abstract_uninstall.rb index 7fff5cfe31..f95a828771 100644 --- a/Library/Homebrew/cask/artifact/abstract_uninstall.rb +++ b/Library/Homebrew/cask/artifact/abstract_uninstall.rb @@ -271,7 +271,7 @@ module Cask end def uninstall_login_item(*login_items, command: nil, successor: nil, **_) - return unless successor.nil? + return if successor apps = cask.artifacts.select { |a| a.class.dsl_key == :app } derived_login_items = apps.map { |a| { path: a.target } } diff --git a/Library/Homebrew/cask/artifact/moved.rb b/Library/Homebrew/cask/artifact/moved.rb index e97a65b6f4..5976146726 100644 --- a/Library/Homebrew/cask/artifact/moved.rb +++ b/Library/Homebrew/cask/artifact/moved.rb @@ -43,7 +43,7 @@ module Cask if Utils.path_occupied?(target) if !predecessor.nil? && target.directory? && target.children.empty? && predecessor.artifacts.any? do |a| - a.class.dsl_key == self.class.dsl_key && a.target == target + a.instance_of?(self.class) && instance_of?(a.class) && a.target == target end # An upgrade removed the directory contents but left the directory itself (see below). unless source.directory? @@ -158,7 +158,7 @@ module Cask return unless Utils.path_occupied?(target) if !successor.nil? && target.directory? && successor.artifacts.any? do |a| - a.class.dsl_key == self.class.dsl_key && a.target == self.target + a.instance_of?(self.class) && instance_of?(a.class) && a.target == self.target end # If an app folder is deleted, macOS considers the app uninstalled and removes some data. # Remove only the contents to handle this case. diff --git a/Library/Homebrew/cask/quarantine.rb b/Library/Homebrew/cask/quarantine.rb index ed36a41d82..0e13a65dd1 100644 --- a/Library/Homebrew/cask/quarantine.rb +++ b/Library/Homebrew/cask/quarantine.rb @@ -179,14 +179,13 @@ module Cask def self.copy_xattrs(from, to) odebug "Copying xattrs from #{from} to #{to}" - copier = system_command!(swift, - args: [ - *swift_target_args, - COPY_XATTRS_SCRIPT, - from, - to, - ]) - copier.success? + system_command!(swift, + args: [ + *swift_target_args, + COPY_XATTRS_SCRIPT, + from, + to, + ]) end end end