bundle/brew_services: tolerate missing launchctl/systemctl#21828
Open
branchv wants to merge 1 commit intoHomebrew:mainfrom
Open
bundle/brew_services: tolerate missing launchctl/systemctl#21828branchv wants to merge 1 commit intoHomebrew:mainfrom
branchv wants to merge 1 commit intoHomebrew:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adjusts brew bundle’s service introspection to no longer fail on systems where brew services isn’t supported (e.g., Linux without systemd), aligning bundle dump behavior with “best-effort” service detection.
Changes:
- Return an empty started-services list when neither
launchctlnorsystemctlis available (instead of exiting). - Update the
brew_servicesspec to expect an empty array in the no-daemon-manager case.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| Library/Homebrew/bundle/brew_services.rb | Makes started_services tolerate missing service managers by returning []. |
| Library/Homebrew/test/bundle/brew_services_spec.rb | Updates expectations to match the new non-fatal behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
6 tasks
ZhongRuoyu
approved these changes
Mar 28, 2026
MikeMcQuaid
reviewed
Mar 28, 2026
Member
MikeMcQuaid
left a comment
There was a problem hiding this comment.
Looks good but sorry more ideas here.
| odie Homebrew::Services::System::MISSING_DAEMON_MANAGER_EXCEPTION_MESSAGE | ||
| end | ||
| @started_services ||= if !Homebrew::Services::System.launchctl? && !Homebrew::Services::System.systemctl? | ||
| opoo "Skipping `brew services list` due to missing launchctl/systemctl" |
Member
There was a problem hiding this comment.
Sorry, I know this is annoying:
- a missing
launchctlbasically never happens - a missing
systemctlis very common in some Linux environments
As a result, I think this should be OS-specific behaviour where we odie on macOS and opoo on Linux.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
brew lgtm(style, typechecking and tests) with your changes locally?Different approach to fix #21720 by not treating a missing
systemctlas a fatal error, which I found surprisingSee also #21722 (comment)