Skip to content

Commit

Permalink
external pipeline: add option to ignore process exit code (#2623)
Browse files Browse the repository at this point in the history
  • Loading branch information
markets committed Feb 6, 2023
1 parent ae5581e commit bb193ce
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class Middleman::Extensions::ExternalPipeline < ::Middleman::Extension
option :source, nil, 'Path to merge into sitemap', required: true
option :latency, 0.25, 'Latency between refreshes of source'
option :disable_background_execution, false, "Don't run the command in a separate background thread"
option :ignore_exit_code, false, 'Ignore exit code for restart or stop of a command'

def initialize(app, config={}, &block)
super
Expand Down Expand Up @@ -65,7 +66,7 @@ def watch_command!(async)

@current_thread.wait

if !@current_thread.exitstatus.nil? && @current_thread.exitstatus != 0
if !options[:ignore_exit_code] && !@current_thread.exitstatus.nil? && @current_thread.exitstatus != 0
logger.error '== External: Command failed with non-zero exit status'
exit(1)
end
Expand Down

0 comments on commit bb193ce

Please sign in to comment.