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... #88

Closed rockallite closed 2 years ago

rockallite commented 2 years ago

before checking recv_ready(), to avoid excess time RECV_READY timeout.

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.

See #87

codecov[bot] commented 2 years ago

Codecov Report

Merging #88 (d0934e5) into master (4fbd871) will increase coverage by 1.28%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #88      +/-   ##
==========================================
+ Coverage   97.43%   98.71%   +1.28%     
==========================================
  Files           1        1              
  Lines         156      156              
==========================================
+ Hits          152      154       +2     
+ Misses          4        2       -2     
Impacted Files Coverage Δ
paramiko_expect.py 98.71% <100.00%> (+1.28%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

fruch commented 2 years ago

@rockallite thanks for this one.

If I won't release to pypi the next few days, give me a ping.

rockallite commented 2 years ago

@fruch please release a new version to pypi that reflects this change. Thank you!

fruch commented 2 years ago

@fruch please release a new version to pypi that reflects this change. Thank you!

https://pypi.org/project/paramiko-expect/0.3.4/