From 3869bf156cfb4d39572283a9c5ec6714ff7b0c18 Mon Sep 17 00:00:00 2001 From: Bevan Kay Date: Thu, 29 Dec 2022 12:54:59 +1100 Subject: [PATCH] change line splitting method --- .../cask/artifact/abstract_uninstall.rb | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Library/Homebrew/cask/artifact/abstract_uninstall.rb b/Library/Homebrew/cask/artifact/abstract_uninstall.rb index 5a92511b18..5c2fab1884 100644 --- a/Library/Homebrew/cask/artifact/abstract_uninstall.rb +++ b/Library/Homebrew/cask/artifact/abstract_uninstall.rb @@ -145,6 +145,16 @@ module Cask end end + def find_launchctl_with_wildcard(search) + regex = Regexp.escape(search).gsub("\\*", ".*") + system_command!("/bin/launchctl", args: ["list"]) + .stdout.lines.drop(1) # skip stdout column headers + .map do |line| + pid, _state, id = line.chomp.split(/\s+/) + id if pid.to_i.nonzero? && id.match?(regex) + end.compact + end + sig { returns(String) } def automation_access_instructions <<~EOS @@ -282,16 +292,6 @@ module Cask end end - def find_launchctl_with_wildcard(search) - regex = Regexp.escape(search).gsub("\\*", ".*") - system_command!("/bin/launchctl", args: ["list"]) - .stdout.lines.drop(1) # skip stdout column headers - .map do |line| - pid, _state, id = line.chomp.split("\t") - id if pid.to_i.nonzero? && id.match?(regex) - end.compact - end - # :kext should be unloaded before attempting to delete the relevant file def uninstall_kext(*kexts, command: nil, **_) kexts.each do |kext|