SSH: use exec_command directly without sh to transfer data

This commit is contained in:
Oleksii Shevchuk 2018-09-19 09:50:50 +03:00
parent eebf843c66
commit c0b0c81121
1 changed files with 2 additions and 3 deletions

View File

@ -295,7 +295,6 @@ class SSH(object):
transport = self._client.get_transport()
session = transport.open_session()
session.exec_command('sh')
commands = []
@ -323,9 +322,9 @@ class SSH(object):
if delete:
commands.append('rm -f {}'.format(repr(remote_path)))
header = ' && '.join(commands) + '\n'
command = ' && '.join(commands)
session.sendall(header)
session.exec_command(command)
def _reader_cb():
data = reader_cb(transport.default_max_packet_size - 1024)