fgimian / paramiko-expect

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

Fix 'OverflowError: timeout value is too large' in tail method #77

Closed droscy closed 2 years ago

droscy commented 2 years ago

Hello, if I leave timeout==None in tail() method, the execution fails with

[...]
  File "C:\workspace\partec\remote-tail-f\venv\lib\site-packages\paramiko_expect.py", line 283, in tail
    buffer = self.channel.recv(1)
  File "C:\workspace\partec\remote-tail-f\venv\lib\site-packages\paramiko\channel.py", line 699, in recv
    out = self.in_buffer.read(nbytes, self.timeout)
  File "C:\workspace\partec\remote-tail-f\venv\lib\site-packages\paramiko\buffered_pipe.py", line 160, in read
    self._cv.wait(timeout)
  File "C:\Users\simone.rossetto\AppData\Local\Programs\Python\Python39\lib\threading.py", line 316, in wait
    gotit = waiter.acquire(True, timeout)
OverflowError: timeout value is too large

Using threading.TIMEOUT_MAX as None (max) timeout value fixes the error.