change line splitting method

This commit is contained in:
Bevan Kay 2022-12-29 12:54:59 +11:00
parent 3bdab156c2
commit 3869bf156c
No known key found for this signature in database
GPG Key ID: C55CB024B5314B57

View File

@ -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|