Logo Search packages:      
Sourcecode: paramiko version File versions  Download package

def paramiko::channel::Channel::recv_stderr (   self,
  nbytes 
)

Receive data from the channel's stderr stream.  Only channels using
L{exec_command} or L{invoke_shell} without a pty will ever have data
on the stderr stream.  The return value is a string representing the
data received.  The maximum amount of data to be received at once is
specified by C{nbytes}.  If a string of length zero is returned, the
channel stream has closed.

@param nbytes: maximum number of bytes to read.
@type nbytes: int
@return: data.
@rtype: str

@raise socket.timeout: if no data is ready before the timeout set by
    L{settimeout}.

@since: 1.1

Definition at line 580 of file channel.py.

00580                                  :
        """
        Receive data from the channel's stderr stream.  Only channels using
        L{exec_command} or L{invoke_shell} without a pty will ever have data
        on the stderr stream.  The return value is a string representing the
        data received.  The maximum amount of data to be received at once is
        specified by C{nbytes}.  If a string of length zero is returned, the
        channel stream has closed.

        @param nbytes: maximum number of bytes to read.
        @type nbytes: int
        @return: data.
        @rtype: str
        
        @raise socket.timeout: if no data is ready before the timeout set by
            L{settimeout}.
        
        @since: 1.1
        """
        out = ''
        self.lock.acquire()
        try:
            if len(self.in_stderr_buffer) == 0:
                if self.closed or self.eof_received:
                    return out
                # should we block?
                if self.timeout == 0.0:
                    raise socket.timeout()
                # loop here in case we get woken up but a different thread has grabbed everything in the buffer
                timeout = self.timeout
                while (len(self.in_stderr_buffer) == 0) and not self.closed and not self.eof_received:
                    then = time.time()
                    self.in_stderr_buffer_cv.wait(timeout)
                    if timeout != None:
                        timeout -= time.time() - then
                        if timeout <= 0.0:
                            raise socket.timeout()
            # something in the buffer and we have the lock
            if len(self.in_stderr_buffer) <= nbytes:
                out = self.in_stderr_buffer
                self.in_stderr_buffer = ''
            else:
                out = self.in_stderr_buffer[:nbytes]
                self.in_stderr_buffer = self.in_stderr_buffer[nbytes:]
            self._check_add_window(len(out))
        finally:
            self.lock.release()
        return out

    def send(self, s):


Generated by  Doxygen 1.6.0   Back to index