-
-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support (and set)
launchd
user domain target
When running `brew services` over `ssh` or `sudo` as a non-`root` user the `gui` domain target for `launchd` does not work as expected. This produces confusing failures for users. It was tried before to detect if this was needed from the `.plist` or changing globally but both approaches were unsuccessful/error-prone. Instead, use the `user` domain automatically on the cases we know it's needed: when running over `ssh` or through `sudo`. To make clear to users what's happening in these cases: output a warning (which can be hidden with an output environment variable). For this to work, `launchctl list` is no longer sufficient. The output here, even when run as `root`, does not properly list `user` domain services. Instead, we need to use `launchctl print` to correctly query the status of these services. This also seems to correctly handle some `launchd` edge-cases where launched services cannot be detected and lets `brew services` now stop them. While we're here, fix some related issues I came upon while working on this: - improve the `brew services` command documentation to note it now runs on Linux/`systemd` too - use `named_args` and remove the `custom_plist` deprecation: it's been long enough and this cleans up the code nicely. - if a service is status `:other` (an edge-case that shouldn't be possible in normal operation): actually output this rather than failing with a `nil` error - avoid running `launchctl list` multiple times when unnecessary - `brew services --debug` now outputs the raw output from `launchctl` or `systemctl` to aid debugging/development - cleanup some code style and avoid use of `plist?` - add `System.systemctl_args` to avoid repeating `System.systemctl` and `System.systemctl_scope` in every call site
- Loading branch information
1 parent
f437459
commit 6a5fcea
Showing
10 changed files
with
120 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.