Class: NexusSW::LXD::Transport::Mixins::Helpers::ExecuteMixin::InteractiveResult
- Inherits:
-
ExecuteResult
- Object
- ExecuteResult
- NexusSW::LXD::Transport::Mixins::Helpers::ExecuteMixin::InteractiveResult
- Defined in:
- lib/nexussw/lxd/transport/mixins/helpers/execute.rb
Instance Attribute Summary collapse
-
#exitstatus ⇒ Object
Returns the value of attribute exitstatus.
-
#stdin ⇒ Object
readonly
Returns the value of attribute stdin.
-
#thread ⇒ Object
readonly
Returns the value of attribute thread.
Attributes inherited from ExecuteResult
Instance Method Summary collapse
- #capture_output(&block) ⇒ Object
- #error! ⇒ Object
-
#initialize(command, options, stdin, thread = nil) ⇒ InteractiveResult
constructor
A new instance of InteractiveResult.
- #send_output(stdout_chunk) ⇒ Object
Methods inherited from ExecuteResult
Constructor Details
#initialize(command, options, stdin, thread = nil) ⇒ InteractiveResult
Returns a new instance of InteractiveResult.
58 59 60 61 62 |
# File 'lib/nexussw/lxd/transport/mixins/helpers/execute.rb', line 58 def initialize(command, , stdin, thread = nil) super(command, , nil) @stdin = stdin @thread = thread end |
Instance Attribute Details
#exitstatus ⇒ Object
Returns the value of attribute exitstatus.
65 66 67 |
# File 'lib/nexussw/lxd/transport/mixins/helpers/execute.rb', line 65 def exitstatus @exitstatus end |
#stdin ⇒ Object (readonly)
Returns the value of attribute stdin.
64 65 66 |
# File 'lib/nexussw/lxd/transport/mixins/helpers/execute.rb', line 64 def stdin @stdin end |
#thread ⇒ Object (readonly)
Returns the value of attribute thread.
64 65 66 |
# File 'lib/nexussw/lxd/transport/mixins/helpers/execute.rb', line 64 def thread @thread end |
Instance Method Details
#capture_output(&block) ⇒ Object
67 68 69 |
# File 'lib/nexussw/lxd/transport/mixins/helpers/execute.rb', line 67 def capture_output(&block) @block = block if block_given? end |
#error! ⇒ Object
80 81 82 83 |
# File 'lib/nexussw/lxd/transport/mixins/helpers/execute.rb', line 80 def error! thread.join if thread.respond_to? :join super end |
#send_output(stdout_chunk) ⇒ Object
71 72 73 74 75 76 77 78 |
# File 'lib/nexussw/lxd/transport/mixins/helpers/execute.rb', line 71 def send_output(stdout_chunk) loop do break if @block sleep 0.1 Thread.pass end @block.call stdout_chunk end |