From 1ddd130ef9c475b69a7896774c8a86172cd86b99 Mon Sep 17 00:00:00 2001 From: Bevan Kay Date: Mon, 19 Dec 2022 14:35:20 +1100 Subject: [PATCH] add comment to .drop(), don't add blank lines to services array --- Library/Homebrew/cask/artifact/abstract_uninstall.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/artifact/abstract_uninstall.rb b/Library/Homebrew/cask/artifact/abstract_uninstall.rb index c6750d27ef..6b0097d5ff 100644 --- a/Library/Homebrew/cask/artifact/abstract_uninstall.rb +++ b/Library/Homebrew/cask/artifact/abstract_uninstall.rb @@ -98,7 +98,10 @@ module Cask all_services << service unless service.include?("*") next unless service.include?("*") - all_services += find_launchctl_with_wildcard(service) + found_services = find_launchctl_with_wildcard(service) + next if found_services.blank? + + found_services.each { |service| all_services += service} end all_services.each do |service| @@ -282,6 +285,7 @@ module Cask def find_launchctl_with_wildcard(search) regex = Regexp.escape(search).gsub("\\*", ".*") system_command!("/bin/launchctl", args: ["list"]) + # skip stdout column headers .stdout.lines.drop(1) .map do |line| pid, _state, id = line.chomp.split("\t")