merge patch to allow bufsize param in SSHClient.exec_command()
This commit is contained in:
Robey Pointer 2007-12-30 16:34:41 -08:00
parent d70878831c
commit 06d3471b46
1 changed files with 6 additions and 4 deletions

View File

@ -299,7 +299,7 @@ class SSHClient (object):
self._transport.close() self._transport.close()
self._transport = None 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 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 the requested command is executed. The command's input and output
@ -308,6 +308,8 @@ class SSHClient (object):
@param command: the command to execute @param command: the command to execute
@type command: str @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 @return: the stdin, stdout, and stderr of the executing command
@rtype: tuple(L{ChannelFile}, L{ChannelFile}, L{ChannelFile}) @rtype: tuple(L{ChannelFile}, L{ChannelFile}, L{ChannelFile})
@ -315,9 +317,9 @@ class SSHClient (object):
""" """
chan = self._transport.open_session() chan = self._transport.open_session()
chan.exec_command(command) chan.exec_command(command)
stdin = chan.makefile('wb') stdin = chan.makefile('wb', bufsize)
stdout = chan.makefile('rb') stdout = chan.makefile('rb', bufsize)
stderr = chan.makefile_stderr('rb') stderr = chan.makefile_stderr('rb', bufsize)
return stdin, stdout, stderr return stdin, stdout, stderr
def invoke_shell(self, term='vt100', width=80, height=24): def invoke_shell(self, term='vt100', width=80, height=24):