Skip to content Skip to sidebar Skip to footer

Paramiko Finish Process Before Reading All Output

I'm Trying to make a real time SSH Library, but as usually getting stuck on things, I have taken this code from Long-running ssh commands in python paramiko module (and how to end

Solution 1:

I couldn't reproduce problem with your command, but I can reproduce it with command like cat some_big_file.txt.

So looks like you are right in your hypothesis. Exit status can be ready before you read all the stuff from your channel. It's not clear if you really need to use select. If not I would rewrite loop:

whileTrue:
    buf = channel.recv(1024)
    if not buf:
        breakprint buf

Such loop will keep reading the channel while it has some data in it. If you really want to use select you can put the above loop just after your loop. It will read and print remaining data.

Post a Comment for "Paramiko Finish Process Before Reading All Output"