Class: NexusSW::LXD::Transport::Mixins::Helpers::ExecuteMixin::InteractiveResult

Inherits:
ExecuteResult
  • Object
show all
Defined in:
lib/nexussw/lxd/transport/mixins/helpers/execute.rb

Instance Attribute Summary collapse

Attributes inherited from ExecuteResult

#command, #options

Instance Method Summary collapse

Methods inherited from ExecuteResult

#stderr, #stdout

Constructor Details

#initialize(command, options, exitstatus, stdin, thread = nil) ⇒ InteractiveResult

Returns a new instance of InteractiveResult.



50
51
52
53
54
# File 'lib/nexussw/lxd/transport/mixins/helpers/execute.rb', line 50

def initialize(command, options, exitstatus, stdin, thread = nil)
  super(command, options, exitstatus)
  @stdin = stdin
  @thread = thread
end

Instance Attribute Details

#exitstatusObject

Returns the value of attribute exitstatus.



57
58
59
# File 'lib/nexussw/lxd/transport/mixins/helpers/execute.rb', line 57

def exitstatus
  @exitstatus
end

#stdinObject (readonly)

Returns the value of attribute stdin.



56
57
58
# File 'lib/nexussw/lxd/transport/mixins/helpers/execute.rb', line 56

def stdin
  @stdin
end

#threadObject (readonly)

Returns the value of attribute thread.



56
57
58
# File 'lib/nexussw/lxd/transport/mixins/helpers/execute.rb', line 56

def thread
  @thread
end

Instance Method Details

#capture_output(&block) ⇒ Object



59
60
61
# File 'lib/nexussw/lxd/transport/mixins/helpers/execute.rb', line 59

def capture_output(&block)
  @block = block if block_given?
end

#error!Object



68
69
70
71
# File 'lib/nexussw/lxd/transport/mixins/helpers/execute.rb', line 68

def error!
  thread.join if thread.respond_to? :join
  super
end

#send_output(stdout_chunk) ⇒ Object



63
64
65
66
# File 'lib/nexussw/lxd/transport/mixins/helpers/execute.rb', line 63

def send_output(stdout_chunk)
  return unless @block
  @block.call stdout_chunk
end