Module: Proxy::Dynflow::Runner::Command
- Included in:
- CommandRunner
- Defined in:
- lib/smart_proxy_dynflow/runner/command.rb
Instance Method Summary collapse
Instance Method Details
#close ⇒ Object
25 26 27 |
# File 'lib/smart_proxy_dynflow/runner/command.rb', line 25 def close close_io end |
#initialize_command(*command) ⇒ Object
4 5 6 7 8 |
# File 'lib/smart_proxy_dynflow/runner/command.rb', line 4 def initialize_command(*command) @command_out, @command_in, @command_pid = PTY.spawn(*command) rescue Errno::ENOENT => e publish_exception("Error running command '#{command.join(' ')}'", e) end |
#refresh ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/smart_proxy_dynflow/runner/command.rb', line 10 def refresh return if @command_out.nil? ready_outputs, * = IO.select([@command_out], nil, nil, 0.1) if ready_outputs if @command_out.nread.positive? lines = @command_out.read_nonblock(@command_out.nread) else close_io Process.wait(@command_pid) publish_exit_status($CHILD_STATUS.exitstatus) end publish_data(lines, 'stdout') if lines && !lines.empty? end end |