Files
Privatae e4c9b69b46
ci / personal-data (push) Successful in 5s
ci / test (push) Successful in 3m4s
ci / fuzz (push) Successful in 3m45s
bastion 0.53.2
2026-10-20 04:42:14 +00:00

43 lines
996 B
Go

//go:build darwin
package main
import (
"path/filepath"
)
// macOS scheduler inventory: LaunchDaemons and LaunchAgents system-wide and
// per user, each plist rendered to JSON by plutil (ships with every macOS)
// so no plist parser enters the module. Apple's own jobs under /System are
// not read: they are the OS, not something a user or an agent installed.
const maxPlists = 800
var launchdDirs = []string{
"/Library/LaunchDaemons/*.plist",
"/Library/LaunchAgents/*.plist",
"/Users/*/Library/LaunchAgents/*.plist",
}
func platformSchedulers() ([]schedEntry, []string, bool) {
all := []schedEntry{}
n := 0
for _, pat := range launchdDirs {
files, _ := filepath.Glob(pat)
for _, f := range files {
if n >= maxPlists {
break
}
n++
out, err := runTimed("plutil", "-convert", "json", "-o", "-", f)
if err != nil {
continue
}
if e, ok := parseLaunchdPlistJSON(out, f); ok {
all = append(all, e)
}
}
}
return all, []string{"launchd"}, true
}