28 Commits

Author SHA1 Message Date
Douglas Eichelberger
fb6c51da07
Enable strict typing in SystemCommand 2025-09-02 10:26:40 -07:00
Mike McQuaid
3bbff84ff1
Merge pull request #20525 from Homebrew/utils_output
Move `o*` output methods to `Utils::Output`
2025-08-22 09:10:29 +00:00
Mike McQuaid
a1f112f3fe
Move o* output methods to Utils::Output
This reduces the surface area of our `Kernel` monkeypatch and removes
the need to `include Kernel` in a bunch of modules.

While we're here, also move `Kernel#require?` to `Homebrew` and fully
scope the calls to it.
2025-08-20 19:20:19 +01:00
Ruoyu Zhong
dde6703237
services/formulae: typed strict
Co-authored-by: Bo Anderson <mail@boanderson.me>
2025-08-21 01:52:56 +08:00
Eric Knibbe
827480f06b
messages/comments: wording fixes 2025-08-16 00:57:59 -04:00
Eric Knibbe
e021953db4
messages/comments: formatting fixes 2025-08-16 00:54:50 -04:00
Mike McQuaid
1d482244e5
service: ensure JSON cron output can be null.
This better matches other field and existing behaviour.
2025-08-06 16:09:39 +01:00
Eric Knibbe
6255263b51
output: express environment variables consistently 2025-08-04 09:50:06 -04:00
Patrick Linnane
4513a43d53
Fix RuboCop failures.
Co-authored-by: Patrick Linnane <patrick@linnane.io>
Co-authored-by: Carlo Cabrera <github@carlo.cab>
Co-authored-by: Thierry Moisan <thierry.moisan@gmail.com>
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2025-07-14 19:12:38 +01:00
Bo Anderson
ae58b3ef21
services: try multiple domains when stopping 2025-05-02 06:19:53 +01:00
Bo Anderson
1db3f6d694
services: fix FileUtils usage in Ruby 3.4 2025-04-16 17:05:51 +01:00
Bo Anderson
52a7b67ba5
Revert "Revert "services: add loaded_file data""
This reverts commit 76901b1352d776a0fb53696b0e61eed420186b0c.
2025-04-07 14:05:39 +01:00
Mike McQuaid
76901b1352
Revert "services: add loaded_file data" 2025-04-04 13:11:13 +01:00
Bo Anderson
a6bee0736f
services: add loaded_file data 2025-04-04 07:25:10 +01:00
Mike McQuaid
c592ae63dd
services: prioritise launchctl print over launchctl list.
In https://github.com/Homebrew/brew/pull/19602 we changed
`launchctl list` to pass the domain target. Sadly, this is not valid
syntax. Instead, restore passing the `service_name` to `launchctl list`
and instead use `launchctl print` first to query the more specific
domain target before we fall back to the less specific service name.
2025-04-03 10:01:45 +01:00
Bo Anderson
2b906e4fe3
services: support --file= in restart command 2025-03-28 05:21:08 +00:00
Bo Anderson
615fb764a1
Add brew bundle services helper 2025-03-28 05:21:07 +00:00
Bo Anderson
0b58e8fd37
services: add --keep flag 2025-03-28 05:21:05 +00:00
Mike McQuaid
2dcd8846a3
services: use domain target in launchctl list command.
If a service is somehow duplicated across multiple domains, this ensures
that the correct output is produced.
2025-03-25 14:16:29 +00:00
Bo Anderson
da003521c6
Support --file for brew services run 2025-03-19 06:13:34 +00:00
Jim Myhrberg
f969c05b20
fix(services/list): correctly handle services with an error code
The `brew services list` command was not correctly handling services
that had an error code status.

While the `#zero?` method returns a boolean, the `#nonzero?` method
confusingly returns self or nil. Hence a negated `#zero?` call to check
for a non-zero exit code fixes the error.

While here, `#pid?` method uses a negated `#zero?`, which is not
accurate, as a negative PID value would not be a valid PID. Hence I
changed it to use `#positive?` instead.

The tests for the `#error?` method were marked as needing systemd, but I
saw no obvious reason for that due to how they all use mocked values, so
I removed the systemd requirement.
2025-03-15 22:13:44 +00:00
Mike McQuaid
c82518032e
Fix services types
Some of the typing/`T.must` usage when moving the
Homebrew/homebrew-services code to Homebrew/brew was not quite correct.

Rather than trying to make everything `strict` and import at the same
time: let's mostly loosen the typing to fix a few bugs and allow us to
add more later.
2025-03-14 16:53:07 +00:00
Bo Anderson
02cd7a63c8
Move Services module to Homebrew namespace 2025-03-14 08:19:11 +00:00
botantony
25b9000c77
spec_helper: add :needs_systemd
Signed-off-by: botantony <antonsm21@gmail.com>
2025-03-13 20:29:26 +01:00
Mike McQuaid
0d3cbcad41
test/services: fix some more tests. 2025-03-13 17:36:46 +00:00
botantony
7a7395a229
services-systemctl: fix testcases
Signed-off-by: botantony <antonsm21@gmail.com>
2025-03-13 17:07:35 +01:00
Mike McQuaid
084ddca27a
Cleanup and fix homebrew-services migration 2025-03-13 15:22:01 +00:00
botantony
3ef52e4844
services: migrate command to main repo (WIP) 2025-03-13 13:22:01 +00:00