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, stdin, thread = nil) ⇒ InteractiveResult

Returns a new instance of InteractiveResult.



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

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

Instance Attribute Details

#exitstatusObject

Returns the value of attribute exitstatus.



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

def exitstatus
  @exitstatus
end

#stdinObject (readonly)

Returns the value of attribute stdin.



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

def stdin
  @stdin
end

#threadObject (readonly)

Returns the value of attribute thread.



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

def thread
  @thread
end

Instance Method Details

#capture_output(&block) ⇒ Object



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

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

#error!Object



72
73
74
75
# File 'lib/nexussw/lxd/transport/mixins/helpers/execute.rb', line 72

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

#send_output(stdout_chunk) ⇒ Object



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

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