lib/runnable.rb in runnable-0.3.0 vs lib/runnable.rb in runnable-0.3.1
- old
+ new
@@ -64,11 +64,15 @@
log_path = opts[:log_path] || false
commands[name] = { :blocking => blocking }
define_method( name ) do |*args|
- run name, block.call(*args), log_path
+ if block
+ run name, block.call(*args), log_path
+ else
+ run name, nil, log_path
+ end
join if blocking
end
end
# Generic command processor. It allows to define generic processors used in all the
@@ -479,13 +483,13 @@
raise SystemCallError.new( exit_status ) if exit_status != 0
end
end
def threaded_output_processor(output_name, pipes, stream_processors)
- exception_processors = stream_processors.is_a?(Hash) ? stream_processors[:exceptions] : {}
+ exception_processors = stream_processors[:exceptions].is_a?(Hash) ? stream_processors[:exceptions] : {}
exception_processors.merge!(self.class.processors[:exceptions] || {})
- output_processors = stream_processors.is_a?(Hash) ? stream_processors[:outputs] : {}
+ output_processors = stream_processors[:outputs].is_a?(Hash) ? stream_processors[:outputs] : {}
output_processors.merge!(self.class.processors[:output] || {})
Thread.new do
pipes[0].close