Update ptyDriver.py
This commit is contained in:
parent
aa6af0bd9e
commit
d85e21224b
@ -75,17 +75,22 @@ class driver(screenDriver):
|
|||||||
self.env['screen']['autoIgnoreScreens'] = []
|
self.env['screen']['autoIgnoreScreens'] = []
|
||||||
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, interruptFdList = None):
|
def readAll(self,fd, timeout = 9999999, interruptFd = None):
|
||||||
starttime = time.time()
|
starttime = time.time()
|
||||||
bytes = os.read(fd, 4096)
|
bytes = os.read(fd, 4096)
|
||||||
if bytes == b'':
|
if bytes == b'':
|
||||||
raise EOFError
|
raise EOFError
|
||||||
# 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.001):
|
fdList = [fd]
|
||||||
|
if interruptFd:
|
||||||
|
fdList += [interruptFd]
|
||||||
|
hasmore = True
|
||||||
|
while hasmore:
|
||||||
|
r, hasmore =screen_utils.hasMoreWaht(fdList,0.01):
|
||||||
|
if not hasmore:
|
||||||
|
break
|
||||||
# exit on stuff like input available
|
# exit on stuff like input available
|
||||||
if interruptFdList:
|
if interruptFd in r:
|
||||||
r, _, _ = select.select(interruptFdList, [], [], 0)
|
|
||||||
if r != []:
|
|
||||||
break
|
break
|
||||||
if (time.time() - starttime) >= timeout:
|
if (time.time() - starttime) >= timeout:
|
||||||
break
|
break
|
||||||
@ -157,7 +162,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.02, interruptFdList=[sys.stdin])
|
msgBytes = self.readAll(self.p_out.fileno(), timeout=0.02, interruptFd=sys.stdin)
|
||||||
except (EOFError, OSError):
|
except (EOFError, OSError):
|
||||||
active.value = False
|
active.value = False
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user