Merge pull request #10151 from reitermarkus/uninstall-quit

Handle running apps in `application.<bundle_id>.<number>.<number>` format.
This commit is contained in:
Markus Reiter 2020-12-29 03:30:02 +01:00 committed by GitHub
commit 3fdd1b28be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -123,11 +123,11 @@ module Cask
def running_processes(bundle_id)
system_command!("/bin/launchctl", args: ["list"])
.stdout.lines
.stdout.lines.drop(1)
.map { |line| line.chomp.split("\t") }
.map { |pid, state, id| [pid.to_i, state.to_i, id] }
.select do |(pid, _, id)|
pid.nonzero? && /^#{Regexp.escape(bundle_id)}($|\.\d+)/.match?(id)
pid.nonzero? && /\A(?:application\.)?#{Regexp.escape(bundle_id)}(?:\.\d+){0,2}\Z/.match?(id)
end
end