Module: Trebor::RemoteCommand
- Includes:
- Command
- Defined in:
- lib/trebor/command.rb
Instance Method Summary collapse
Methods included from Command
#as, #call, #on, #test?, #with, #within
Instance Method Details
#run(command) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/trebor/command.rb', line 53 def run(command) status = nil ssh.open_channel do |channel| channel.exec fetch(command) do |ch, success| channel.on_data do |ch, data| Trebor.logger.info data.chomp end channel.on_extended_data do |ch, type, data| Trebor.logger.error data.chomp + " [#{type}]" end channel.on_request('exit-status') do |ch, data| status = data.read_long end end end ssh.loop status end |