From cd51bfc031eb9163fd6c85bb3d4ec23476bb2090 Mon Sep 17 00:00:00 2001 From: Michael van der Kolff Date: Fri, 30 Nov 2012 22:02:09 +1100 Subject: [PATCH] Add support for get_pty to SSHClient.exec_command() --- paramiko/client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/paramiko/client.py b/paramiko/client.py index a777b45..f863806 100644 --- a/paramiko/client.py +++ b/paramiko/client.py @@ -349,7 +349,7 @@ class SSHClient (object): self._agent.close() self._agent = None - def exec_command(self, command, bufsize=-1, timeout=None): + def exec_command(self, command, bufsize=-1, timeout=None, get_pty=False): """ Execute a command on the SSH server. A new L{Channel} is opened and the requested command is executed. The command's input and output @@ -368,6 +368,8 @@ class SSHClient (object): @raise SSHException: if the server fails to execute the command """ chan = self._transport.open_session() + if(get_pty): + chan.get_pty() chan.settimeout(timeout) chan.exec_command(command) stdin = chan.makefile('wb', bufsize)