Method: Net::SSH::Test::Script#sends_channel_request
- Defined in:
- lib/net/ssh/test/script.rb
#sends_channel_request(channel, request, reply, data, success = true) ⇒ Object
Scripts the sending of a new channel request packet to the remote host. channel should be an instance of Net::SSH::Test::Channel. request is a string naming the request type to send, reply is a boolean indicating whether a response to this packet is required , and data is any additional request-specific data that this packet should send. success indicates whether the response (if one is required) should be success or failure. If data is an array it will be treated as multiple data.
If a reply is desired, a remote packet will also be queued, :channel_success if success is true, or :channel_failure if success is false.
This will typically be called via Net::SSH::Test::Channel#sends_exec or Net::SSH::Test::Channel#sends_subsystem.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/net/ssh/test/script.rb', line 74 def sends_channel_request(channel, request, reply, data, success=true) if data.is_a? Array events << LocalPacket.new(:channel_request, channel.remote_id, request, reply, *data) else events << LocalPacket.new(:channel_request, channel.remote_id, request, reply, data) end if reply if success events << RemotePacket.new(:channel_success, channel.local_id) else events << RemotePacket.new(:channel_failure, channel.local_id) end end end |