fix: launchctl list can return empty id

causing

Error: undefined method `match?' for nil:NilClass

Seen in macOS Big Sur
This commit is contained in:
Carlos Sanchez 2020-11-24 10:47:25 +01:00
parent 04549ff16f
commit 278bc77f2d

View File

@ -127,7 +127,7 @@ module Cask
.map { |line| line.chomp.split("\t") }
.map { |pid, state, id| [pid.to_i, state.to_i, id] }
.select do |(pid, _, id)|
pid.nonzero? && id.match?(/^#{Regexp.escape(bundle_id)}($|\.\d+)/)
pid.nonzero? && /^#{Regexp.escape(bundle_id)}($|\.\d+)/.match?(id)
end
end