mirror of
https://github.com/wavetermdev/homebrew-cask.git
synced 2026-08-05 13:43:24 -07:00
cmd/lib/check.rb: skip apple system launchjobs (#123352)
* cmd/lib/check.rb: skip apple system launchjobs * use constant for repeated regex
This commit is contained in:
+5
-1
@@ -1,6 +1,9 @@
|
||||
# typed: false
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "forwardable"
|
||||
APPLE_LAUNCHJOBS_REGEX =
|
||||
/\A(?:application\.)?com\.apple\.(installer|Safari|systemevents|systempreferences)(?:\.|$)/.freeze
|
||||
|
||||
module Check
|
||||
CHECKS = {
|
||||
@@ -48,7 +51,7 @@ module Check
|
||||
system_command!("/bin/launchctl", args: ["list"], print_stderr: false, sudo: sudo)
|
||||
.stdout
|
||||
.lines.drop(1)
|
||||
.grep_v(/\A(?:application\.)?com\.apple\.(installer|Safari|systemevents|systempreferences)(?:\.|$)/)
|
||||
.grep_v(APPLE_LAUNCHJOBS_REGEX)
|
||||
end
|
||||
|
||||
[false, true]
|
||||
@@ -124,6 +127,7 @@ module Check
|
||||
running_apps = diff[:loaded_launchjobs]
|
||||
.added
|
||||
.grep(/\.\d+\Z/)
|
||||
.grep_v(APPLE_LAUNCHJOBS_REGEX)
|
||||
.map { |id| id.sub(/\A(?:application\.)?(.*?)(?:\.\d+){0,2}\Z/, '\1') }
|
||||
|
||||
loaded_launchjobs = diff[:loaded_launchjobs]
|
||||
|
||||
Reference in New Issue
Block a user