From 161c3163830b24342a5b7b321f2628b2a305bc93 Mon Sep 17 00:00:00 2001 From: chrys Date: Tue, 27 Mar 2018 14:16:22 +0200 Subject: [PATCH] decrease timeout --- src/fenrirscreenreader/screenDriver/ptyDriver.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/fenrirscreenreader/screenDriver/ptyDriver.py b/src/fenrirscreenreader/screenDriver/ptyDriver.py index 721d58c3..0e1f480d 100644 --- a/src/fenrirscreenreader/screenDriver/ptyDriver.py +++ b/src/fenrirscreenreader/screenDriver/ptyDriver.py @@ -82,12 +82,15 @@ class driver(screenDriver): self.env['general']['prevUser'] = getpass.getuser() self.env['general']['currUser'] = getpass.getuser() def readAll(self,fd, timeout = 9999999): + starttime = time.time() bytes = os.read(fd, 65536) if bytes == b'': raise EOFError - starttime = time.time() # respect timeout but wait a little bit of time to see if something more is here - while screen_utils.hasMore(fd,0.0000001) and (time.time() - starttime) >= timeout: + while screen_utils.hasMore(fd,0.0000001): + if (time.time() - starttime) >= timeout: + print('timeout') + break data = os.read(fd, 65536) if data == b'': raise EOFError @@ -154,7 +157,7 @@ class driver(screenDriver): # output if self.p_out in r: try: - msgBytes = self.readAll(self.p_out.fileno(), timeout=0.01) + msgBytes = self.readAll(self.p_out.fileno(), timeout=0.005) except (EOFError, OSError): active.value = False break