def recv_exit_status(self, command, timeout=10, get_pty=False):
        """
        Execute a command and get its return value

        @param command: command to execute
        @type command: str

        @param timeout: command execution timeout
        @type timeout: int

        @param get_pty: get pty
        @type get_pty: bool

        @return: the exit code of the process or None in case of timeout
        @rtype: int or None
        """
        status = None
        self.last_command = command
        stdin, stdout, stderr = self.cli.exec_command(command, get_pty=get_pty)
        if stdout and stderr and stdin:
            for _ in range(timeout):
                if stdout.channel.exit_status_ready():
                    status = stdout.channel.recv_exit_status()
                    break
                time.sleep(1)

            self.last_stdout = stdout.read()
            self.last_stderr = stderr.read()

            stdin.close()
            stdout.close()
            stderr.close()
        return status
def recv_exit_status ( self , command , timeout = 10 , get_pty = False ) : status = None self . last_command = command stdin , stdout , stderr = self . cli . exec_command ( command , get_pty = get_pty ) if stdout and stderr and stdin : for _ in range ( timeout ) : if stdout . channel . exit_status_ready ( ) : status = stdout . channel . recv_exit_status ( ) break time . sleep ( 1 ) self . last_stdout = stdout . read ( ) self . last_stderr = stderr . read ( ) stdin . close ( ) stdout . close ( ) stderr . close ( ) return status
Execute a command and get its return value

        @param command: command to execute
        @type command: str

        @param timeout: command execution timeout
        @type timeout: int

        @param get_pty: get pty
        @type get_pty: bool

        @return: the exit code of the process or None in case of timeout
        @rtype: int or None