Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions cmd/list-loaded-launchjob-ids.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# typed: strict
# frozen_string_literal: true

require "abstract_command"
require "open3"

module Homebrew
module Cmd
class ListLoadedLaunchjobIdsCmd < AbstractCommand
cmd_args do
usage_banner <<~EOS
`list-loaded-launchjob-ids`

List IDs for currently loaded launchd jobs. Job IDs attributed to Apple are excluded from the output.
EOS

named_args :none

hide_from_man_page!
end

sig { override.returns(T.nilable(String)) }
def run
prompt = "The system password is required to see all launchd jobs: "
command = "/bin/launchctl list"
running, = Open3.capture3("/usr/bin/sudo -p '#{prompt}' -- #{command} && #{command}")

exclude = /^Label$|^com\.apple\.|\.[0-9]+$/
puts running
.lines
.map { it.split(/\s+/).last }
.reject { exclude.match(it) }
.sort
end
end
end
end
26 changes: 0 additions & 26 deletions developer/bin/list_loaded_launchjob_ids

This file was deleted.

Loading