Skip to content

Commit 1d48224

Browse files
committed
service: ensure JSON cron output can be null.
This better matches other field and existing behaviour.
1 parent 5e1fd26 commit 1d48224

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Library/Homebrew/service.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,9 +529,9 @@ def to_hash
529529

530530
return { name: name_params }.compact_blank if @run_params.blank?
531531

532-
cron_string = unless @cron.empty?
532+
cron_string = if @cron.present?
533533
[:Minute, :Hour, :Day, :Month, :Weekday]
534-
.map { |key| @cron[key].to_s }
534+
.filter_map { |key| @cron[key].to_s.presence }
535535
.join(" ")
536536
end
537537

@@ -555,7 +555,7 @@ def to_hash
555555
run: @run_params,
556556
run_type: @run_type,
557557
interval: @interval,
558-
cron: cron_string,
558+
cron: cron_string.presence,
559559
keep_alive: @keep_alive,
560560
launch_only_once: @launch_only_once,
561561
require_root: @require_root,

Library/Homebrew/services/formula_wrapper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def to_hash
227227
hash[:log_path] = service.log_path
228228
hash[:error_log_path] = service.error_log_path
229229
hash[:interval] = service.interval
230-
hash[:cron] = service.cron
230+
hash[:cron] = service.cron.presence
231231

232232
hash
233233
end

0 commit comments

Comments
 (0)