shell.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:iosxr-ansible 作者: ios-xr 项目源码 文件源码
def send(self, commands):
        responses = list()
        try:
            for command in to_list(commands):
                signal.alarm(self._timeout)
                self._history.append(str(command))
                cmd = '%s\r' % str(command)
                self.shell.sendall(cmd)
                if self._timeout == 0:
                    return
                responses.append(self.receive(command))

        except socket.timeout:
            raise ShellError("timeout trying to send command: %s" % cmd)

        except socket.error:
            exc = get_exception()
            raise ShellError("problem sending command to host: %s" % to_native(exc))

        return responses
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号