fgimian / paramiko-expect

A Python expect-like extension for the Paramiko SSH library which also supports tailing logs.
MIT License
205 stars 78 forks source link

Check whether channel is closed before checking recv_ready() #87

Closed rockallite closed 2 years ago

rockallite commented 2 years ago

Some network routers send a message and close the channel after they receive an exit command. If you want to grab the exit message, you should check whether the channel is closed, and if so, read the resting bytes in the closed channel other than waiting for self.channel. recv_ready() (which is always False on a closed channel) and timing out.

fruch commented 2 years ago

fixed in #88