SSH2::Channel
Inherits IO / Reference / Object
Constants
Constructors
Instance methods
Close an active data channel. In practice this means sending an
SSH_MSG_CLOSE packet to the remote host which serves as instruction that no
further data will be sent to it. The remote host may still send data back
until it sends its own close message in response. To wait for the remote
end to close its connection as well, follow this command with
wait_closed or pass wait parameter as true.
Returns true if this IO is closed.
IO defines returns false, but including types may override.
Return a tuple with first field populated with the exit signal (without leading "SIG"), and the second field populated with the error message.
Returns the exit code raised by the process running on the remote host at the other end of the named channel. Note that the exit status may not be available if the remote end has not yet set its status to closed.
LibSSH2::ExtendedData::NORMAL - Queue extended data for eventual reading
LibSSH2::ExtendedData::MERGE - Treat extended data and ordinary data the
same. Merge all substreams such that calls to read, will pull from all
substreams on a first-in/first-out basis.
LibSSH2::ExtendedData::IGNORE - Discard all extended data as it arrives.
Request a process on the channel. request is one of PROCESS_SHELL,
PROCESS_EXEC or PROCESS_SUBSYSTEM; prefer shell, command or subsystem.
Read up to slice.bytesize bytes from substream stream_id into slice,
returning the number of bytes read.
IO#read: reads from the main (stdout) substream into slice, returning the
number of bytes read, or 0 at end-of-file.
Adjust the receive window for a channel by adjustment bytes. If the amount
to be adjusted is less than LibSSH2::CHANNEL_MINADJUST and force is false the
adjustment amount will be queued for a later packet.
Returns a new size of the receive window (as understood by remote end).
Request a PTY on an established channel. Note that this does not make sense for all channel types and may be ignored by the server despite returning success.
Tell the remote host that no further data will be sent on the specified channel. Processes typically interpret this as a closed stdin descriptor.
Set an environment variable in the remote channel's process space. Note that this does not make sense for all channel types and may be ignored by the server despite returning success.
The number of bytes which the remote end may send without overflowing the window limit
Check the status of the write window Returns the number of bytes which may be safely written on the channel without blocking.
Write all of slice to substream stream_id, returning the number of bytes
written.
channel_write can write less than we asked. loop until slice is done. n == 0 is allowed by libssh2 (buffered, not acked). yield so we don't spin.
Writes the contents of slice into this IO.
io = IO::Memory.new
slice = Bytes.new(4) { |i| ('a'.ord + i).to_u8 }
io.write(slice)
io.to_s # => "abcd"