Module: NexusSW::LXD::Transport::Mixins::Helpers::ExecuteMixin
Defined Under Namespace
Classes: ExecuteResult, InteractiveResult
Instance Method Summary collapse
-
#execute(command, options = {}, &block) ⇒ Object
LocalTransport does not have the users mixin, so code the ‘su` command on the rest & cli transports directly.
Instance Method Details
#execute(command, options = {}, &block) ⇒ Object
LocalTransport does not have the users mixin, so code the ‘su` command on the rest & cli transports directly
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/nexussw/lxd/transport/mixins/helpers/execute.rb', line 41 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 |