I know exec_command
returns 3 streams, but I'm unable to print the output as it should arrive to these streams.
client = SSHClient()
client.load_system_host_keys()
client.connect('ssh.example.com')
stdin, stdout, stderr = client.exec_command('ls -l; sleep 10; ls -l')
for line in stdout.readlines():
print line
for line in stderr.readlines():
print line
This seems to output new lines only at the end when the entire command has been finished. I'd like to receive the characters as they are generated by the remote commands. Is this possible?
To read the output on your terminal, the method i knew is to stream the readbinaries and writebinaries straight from the ssh session into your terminal