2.3.0
Changes
SSHClientnow starts buffering output from remote host, both standard output and standard error, when a command is run.SSHClient.read_output,SSHClient.read_stderrand iterating on stdout/stderr fromHostOutputnow read from the internal buffer rather than the SSH channel directly.ParallelSSHClient.joinno longer requiresconsume_outputto be set in order to get exit codes without first reading output.ParallelSSHClient.joinwith timeout no longer consumes output by default. It is now possible to usejoinwith a timeout and capture output afterjoincompletes.ParallelSSHClient.reset_output_generatorsis now a no-op and no longer required to be called after timeouts.HostOutput.stdoutandstderrare now dynamic properties.- Added
HostOutput.read_timeoutattribute. Can be used to see what read timeout was whenrun_commandwas called and to change timeout when next reading fromHostOutput.stdoutandstderr. - Added
HostOutput.encodingattribute for encoding used whenrun_commandwas called. Encoding can now be changed for when next reading output. ParallelSSHClient.joinwith timeout no longer affectsstdoutorstderrread timeout set whenrun_commandwas called.- LibSSH clients under
pssh.clients.sshnow allow output to be read as it becomes available without waiting for remote command to finish first. - Reading from output behaviour is now consistent across all client types - parallel and single clients under both
pssh.clients.nativeandpssh.clients.ssh. ParallelSSHClient.joincan now be called without arguments and defaults to last ran commands.ParallelSSHClient.finishedcan now be called without arguments and defaults to last ran commands.
This is now possible:
output = client.run_command(<..>)
client.join(output)
assert output[0].exit_code is not None
As is this:
client.run_command(<..>, timeout=1)
client.join(output, timeout=1)
for line in output[0].stdout:
print(line)
Output can be read after and has separate timeout from join.