Method: Net::SSH::Connection::Channel#on_data

Defined in:
lib/net/ssh/connection/channel.rb

#on_data(&block) ⇒ Object

Registers a callback to be invoked when data packets are received by the channel. The callback is called with the channel as the first argument, and the data as the second.

channel.on_data do |ch, data|
  puts "got data: #{data.inspect}"
end

Data received this way is typically the data written by the remote process to its stdout stream.



330
331
332
333
# File 'lib/net/ssh/connection/channel.rb', line 330

def on_data(&block)
  old, @on_data = @on_data, block
  old
end