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

def paramiko::channel::Channel::exec_command (   self,
  command 
)

Execute a command on the server.  If the server allows it, the channel
will then be directly connected to the stdin, stdout, and stderr of
the command being executed.

When the command finishes executing, the channel will be closed and
can't be reused.  You must open a new channel if you wish to execute
another command.

@param command: a shell command to execute.
@type command: str
@return: C{True} if the operation succeeded; C{False} if not.
@rtype: bool

Definition at line 190 of file channel.py.

00190                                    :
        """
        Execute a command on the server.  If the server allows it, the channel
        will then be directly connected to the stdin, stdout, and stderr of
        the command being executed.
        
        When the command finishes executing, the channel will be closed and
        can't be reused.  You must open a new channel if you wish to execute
        another command.

        @param command: a shell command to execute.
        @type command: str
        @return: C{True} if the operation succeeded; C{False} if not.
        @rtype: bool
        """
        if self.closed or self.eof_received or self.eof_sent or not self.active:
            raise SSHException('Channel is not open')
        m = Message()
        m.add_byte(chr(MSG_CHANNEL_REQUEST))
        m.add_int(self.remote_chanid)
        m.add_string('exec')
        m.add_boolean(1)
        m.add_string(command)
        self.event.clear()
        self.transport._send_user_message(m)
        while True:
            self.event.wait(0.1)
            if self.closed:
                return False
            if self.event.isSet():
                return True

    def invoke_subsystem(self, subsystem):


Generated by  Doxygen 1.6.0   Back to index