decrease timeout

This commit is contained in:
chrys 2018-03-27 14:16:22 +02:00
parent d3b97bcd30
commit 161c316383

View File

@ -82,12 +82,15 @@ class driver(screenDriver):
self.env['general']['prevUser'] = getpass.getuser() self.env['general']['prevUser'] = getpass.getuser()
self.env['general']['currUser'] = getpass.getuser() self.env['general']['currUser'] = getpass.getuser()
def readAll(self,fd, timeout = 9999999): def readAll(self,fd, timeout = 9999999):
starttime = time.time()
bytes = os.read(fd, 65536) bytes = os.read(fd, 65536)
if bytes == b'': if bytes == b'':
raise EOFError raise EOFError
starttime = time.time()
# respect timeout but wait a little bit of time to see if something more is here # 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) data = os.read(fd, 65536)
if data == b'': if data == b'':
raise EOFError raise EOFError
@ -154,7 +157,7 @@ class driver(screenDriver):
# output # output
if self.p_out in r: if self.p_out in r:
try: try:
msgBytes = self.readAll(self.p_out.fileno(), timeout=0.01) msgBytes = self.readAll(self.p_out.fileno(), timeout=0.005)
except (EOFError, OSError): except (EOFError, OSError):
active.value = False active.value = False
break break