def exec_command(self, client, command, timeout=None, get_pty=False, environment=None):
channel = client._transport.open_session(timeout=timeout)
if get_pty:
width, height = get_terminal_size()
channel.get_pty(width=width, height=height)
channel.settimeout(timeout)
if environment:
channel.update_environment(environment)
channel.exec_command(command)
return channel
评论列表
文章目录