Merge pull request #9274 from carlossg/nil

fix: launchctl list can return empty id
This commit is contained in:
Markus Reiter 2020-11-25 17:58:31 +01:00 committed by GitHub
commit e354a4f2d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -127,7 +127,7 @@ module Cask
.map { |line| line.chomp.split("\t") } .map { |line| line.chomp.split("\t") }
.map { |pid, state, id| [pid.to_i, state.to_i, id] } .map { |pid, state, id| [pid.to_i, state.to_i, id] }
.select do |(pid, _, 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
end end