I try to backup a server using Paramiko and ssh to call a tar
command. When there is a limited number of files, all works well but when it\'s a big folder, the
read data before check exit status
channel.recv_exit_status() hanging
If the ls -R
prints lots of error output (what is likely if the current user is not root
=> does not have access to all folders), your code deadlocks eventually.
It's because, the output buffer of the error stream eventually fills, so the ls
stops working, waiting for you to read the stream (empty the buffer).
While you wait for the regular output stream to finish, what it never does, as the ls
waits for you to read the error stream, what you never do.
You have to read both streams in parallel.
Or even easier, use the Channel.set_combine_stderr to merge both streams to one.