Merge pull request #20389 from Homebrew/service_cron_null

service: ensure JSON cron output can be `null`.
This commit is contained in:
Mike McQuaid 2025-08-06 16:30:04 +00:00 committed by GitHub
commit 726f83c4a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -529,9 +529,9 @@ module Homebrew
return { name: name_params }.compact_blank if @run_params.blank? return { name: name_params }.compact_blank if @run_params.blank?
cron_string = unless @cron.empty? cron_string = if @cron.present?
[:Minute, :Hour, :Day, :Month, :Weekday] [:Minute, :Hour, :Day, :Month, :Weekday]
.map { |key| @cron[key].to_s } .filter_map { |key| @cron[key].to_s.presence }
.join(" ") .join(" ")
end end
@ -555,7 +555,7 @@ module Homebrew
run: @run_params, run: @run_params,
run_type: @run_type, run_type: @run_type,
interval: @interval, interval: @interval,
cron: cron_string, cron: cron_string.presence,
keep_alive: @keep_alive, keep_alive: @keep_alive,
launch_only_once: @launch_only_once, launch_only_once: @launch_only_once,
require_root: @require_root, require_root: @require_root,

View File

@ -227,7 +227,7 @@ module Homebrew
hash[:log_path] = service.log_path hash[:log_path] = service.log_path
hash[:error_log_path] = service.error_log_path hash[:error_log_path] = service.error_log_path
hash[:interval] = service.interval hash[:interval] = service.interval
hash[:cron] = service.cron hash[:cron] = service.cron.presence
hash hash
end end