lib/rake/funnel/extensions/shell.rb in rake-funnel-0.18.0 vs lib/rake/funnel/extensions/shell.rb in rake-funnel-0.19.0
- old
+ new
@@ -10,17 +10,18 @@
def shell(*cmd, log_file: nil, error_lines: nil, &block)
mkdir_p(File.dirname(log_file)) if log_file
run(cmd, log_file, error_lines) do |success, readable_cmd, result, log|
if block
- block.call(success, readable_cmd, result, log)
+ yield(success, readable_cmd, result, log)
return
end
end
end
private
+
def run(cmd, log_file, error_lines)
cmd, readable_cmd = normalize(cmd)
Rake.rake_output_message(readable_cmd)
@@ -30,10 +31,10 @@
result = [readable_cmd, wait_thread.value.exitstatus, log]
yield(success, *result) if block_given?
- fail Rake::Funnel::ExecutionError.new(*result) unless success
+ raise Rake::Funnel::ExecutionError.new(*result) unless success
end
end
def normalize(cmd)
cmd = cmd.flatten.reject(&:nil?)