aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/lib
diff options
context:
space:
mode:
authorMarkus Reiter2017-09-12 04:18:56 +0200
committerGitHub2017-09-12 04:18:56 +0200
commitbecd8d8bc4dda1973849677deeb46590802f0f91 (patch)
tree9ab54b2d84ed03aa13885fb5e4c11e7d1f1d3784 /Library/Homebrew/cask/lib
parentda742d8e8e5309395c31b5047d2c2f2b8ef5650c (diff)
parent76cb1462d45e4be8b37354bfea2187bf23dcf124 (diff)
downloadbrew-becd8d8bc4dda1973849677deeb46590802f0f91.tar.bz2
Merge pull request #3148 from reitermarkus/uninstall-signal
Fix uninstall with `:signal`.
Diffstat (limited to 'Library/Homebrew/cask/lib')
-rw-r--r--Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb b/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb
index 2ce4f399d..badd549ce 100644
--- a/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb
+++ b/Library/Homebrew/cask/lib/hbc/artifact/abstract_uninstall.rb
@@ -28,6 +28,7 @@ module Hbc
def initialize(cask, directives)
super(cask)
+ directives[:signal] = [*directives[:signal]].flatten.each_slice(2).to_a
@directives = directives
end
@@ -35,6 +36,10 @@ module Hbc
directives.to_h
end
+ def summarize
+ to_h.map { |key, val| [*val].map { |v| "#{key.inspect} => #{v.inspect}" }.join(", ") }.join(", ")
+ end
+
private
def dispatch_uninstall_directives(**options)
@@ -122,15 +127,15 @@ module Hbc
end
# :signal should come after :quit so it can be used as a backup when :quit fails
- def uninstall_signal(*signals, **options)
- signals.flatten.each_slice(2) do |pair|
+ def uninstall_signal(*signals, command: nil, **_)
+ signals.each do |pair|
unless pair.size == 2
raise CaskInvalidError.new(cask, "Each #{stanza} :signal must consist of 2 elements.")
end
signal, bundle_id = pair
ohai "Signalling '#{signal}' to application ID '#{bundle_id}'"
- pids = running_processes(bundle_id, **options).map(&:first)
+ pids = running_processes(bundle_id, command: command).map(&:first)
next unless pids.any?
# Note that unlike :quit, signals are sent from the current user (not
# upgraded to the superuser). This is a todo item for the future, but