From 06d3471b463ffe798d42e7d24e294bbc616d8358 Mon Sep 17 00:00:00 2001 From: Robey Pointer Date: Sun, 30 Dec 2007 16:34:41 -0800 Subject: [PATCH] [project @ robey@lag.net-20071231003441-njdbcgbrqskrgtiw] merge patch to allow bufsize param in SSHClient.exec_command() --- paramiko/client.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/paramiko/client.py b/paramiko/client.py index c809e4b..127ab13 100644 --- a/paramiko/client.py +++ b/paramiko/client.py @@ -299,7 +299,7 @@ class SSHClient (object): self._transport.close() self._transport = None - def exec_command(self, command): + def exec_command(self, command, bufsize=-1): """ 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 @@ -308,6 +308,8 @@ class SSHClient (object): @param command: the command to execute @type command: str + @param bufsize: interpreted the same way as by the built-in C{file()} function in python + @type bufsize: int @return: the stdin, stdout, and stderr of the executing command @rtype: tuple(L{ChannelFile}, L{ChannelFile}, L{ChannelFile}) @@ -315,9 +317,9 @@ class SSHClient (object): """ chan = self._transport.open_session() chan.exec_command(command) - stdin = chan.makefile('wb') - stdout = chan.makefile('rb') - stderr = chan.makefile_stderr('rb') + stdin = chan.makefile('wb', bufsize) + stdout = chan.makefile('rb', bufsize) + stderr = chan.makefile_stderr('rb', bufsize) return stdin, stdout, stderr def invoke_shell(self, term='vt100', width=80, height=24):