Class Net::SSH::Service::Process::POpen3Manager::SSHOutputPipe
In: lib/net/ssh/service/process/popen3.rb
Parent: Object

An abstract class representing a writable stream on a channel. This is subclassed by SSHStdoutPipe and SSHStderrPipe.

Methods

data_available?   new   read  

Attributes

channel  [R]  The channel used by this pipe.

Public Class methods

Create a new output pipe on the given channel.

[Source]

     # File lib/net/ssh/service/process/popen3.rb, line 106
106:             def initialize( channel )
107:               @channel = channel
108:               @data = ""
109:             end

Public Instance methods

Returns true if there are any bytes available on this pipe. This will do a non-blocking read on the connection to determine if there

[Source]

     # File lib/net/ssh/service/process/popen3.rb, line 114
114:             def data_available?
115:               if @data.length == 0
116:                 connection = @channel.connection
117:                 connection.process while connection.reader_ready?
118:               end
119:               @data.length > 0
120:             end

Read all available bytes from the pipe. If there are no available bytes, then this will block until data becomes available.

[Source]

     # File lib/net/ssh/service/process/popen3.rb, line 124
124:             def read
125:               if @data.length < 1
126:                 @channel.connection.process while @data.length < 1
127:               end
128: 
129:               data, @data = @data, ""
130:               return data
131:             end

[Validate]