1
0
Fork 0
mirror of https://github.com/middleman/middleman.git synced 2022-11-09 12:20:27 -05:00

Add ability to external pipeline ignore process exit code (#2353)

This commit is contained in:
Alexey Vasiliev 2020-08-15 01:24:28 +03:00 committed by GitHub
parent d7f0ed06d3
commit a03aed2d6d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,7 @@ class Middleman::Extensions::ExternalPipeline < ::Middleman::Extension
option :source, nil, 'Path to merge into sitemap', required: true option :source, nil, 'Path to merge into sitemap', required: true
option :latency, 0.25, 'Latency between refreshes of source' 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 :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, options_hash = ::Middleman::EMPTY_HASH, &block) def initialize(app, options_hash = ::Middleman::EMPTY_HASH, &block)
super super
@ -67,7 +68,7 @@ class Middleman::Extensions::ExternalPipeline < ::Middleman::Extension
@current_thread.wait @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' logger.error '== External: Command failed with non-zero exit status'
exit(1) exit(1)
end end