- `launchctl list` does not work as expected in the sandbox.
- Probe with `launchctl print <domain>/<label>` instead,
which launchd does allow a sandboxed process, and key
off exit codes: 0 means registered, 113 (ENOSERVICE)
means not registered, and anything else is an error rather
than being mistranslated into a negative.
- The probe is advisory in `system status`, so an indeterminate
answer falls through to the XPC health check, whose success
is authoritative.
Signed-off-by: Renlord Yang <renlord@apple.com>
This PR reaps already running containers with auto remove flag on
container system start.
Container API server shutdown ideally should stop every running
container, and reap the containers with auto remove flag. However, crash
or unexpected exit of API server leaves the containers running. In such
case, next system start should stop running containers (i.e., launchd
services) and reap the containers with auto remove flag.
## Type of Change
- [X] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Motivation and Context
Preserve the system to be in a consistent state after unexpected
failure.
## Testing
- [X] Tested locally
- [ ] Added/updated tests
- [ ] Added/updated docs
---------
Co-authored-by: Raj <realrajaryan@gmail.com>