Module: NexusSW::LXD::Transport::Mixins::Helpers::ExecuteMixin
Defined Under Namespace
Classes: ExecuteResult, InteractiveResult
Instance Method Summary collapse
Instance Method Details
#execute(command, options = {}, &block) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/nexussw/lxd/transport/mixins/helpers/execute.rb', line 33 def execute(command, = {}, &block) ||= {} return execute_chunked(command, ) if [:capture] == false && !block_given? = { stdout: '', stderr: '' } [:capture] = block if block_given? [:capture] ||= [:capture] if [:capture].respond_to? :call # capture_options[:capture] ||= options[:stream] if options[:stream].respond_to? :call [:capture] ||= proc do |stdout_chunk, stderr_chunk| [:stdout] += stdout_chunk if stdout_chunk [:stderr] += stderr_chunk if stderr_chunk end execute_chunked(command, .merge(capture_options: ), &[:capture]) end |