parent
d380ab711d
commit
ecacae23d0
@ -103,7 +103,7 @@ 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 = -1, interruptFd = None, len = 65536):
|
def readAll(self, fd, timeout = 1, interruptFd = None, len = 65536):
|
||||||
msgBytes = b''
|
msgBytes = b''
|
||||||
fdList = []
|
fdList = []
|
||||||
fdList += [fd]
|
fdList += [fd]
|
||||||
@ -111,7 +111,7 @@ class driver(screenDriver):
|
|||||||
fdList += [interruptFd]
|
fdList += [interruptFd]
|
||||||
starttime = time.time()
|
starttime = time.time()
|
||||||
while True:
|
while True:
|
||||||
r = screen_utils.hasMoreWhat(fdList)
|
r = screen_utils.hasMoreWhat(fdList, 0.0001)
|
||||||
# nothing more to read
|
# nothing more to read
|
||||||
if not fd in r:
|
if not fd in r:
|
||||||
break
|
break
|
||||||
@ -123,9 +123,8 @@ class driver(screenDriver):
|
|||||||
if interruptFd in r:
|
if interruptFd in r:
|
||||||
break
|
break
|
||||||
# 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
|
||||||
if timeout != -1:
|
if (time.time() - starttime) >= timeout:
|
||||||
if (time.time() - starttime) >= timeout:
|
break
|
||||||
break
|
|
||||||
return msgBytes
|
return msgBytes
|
||||||
def openTerminal(self, columns, lines, command):
|
def openTerminal(self, columns, lines, command):
|
||||||
p_pid, master_fd = pty.fork()
|
p_pid, master_fd = pty.fork()
|
||||||
@ -178,7 +177,7 @@ class driver(screenDriver):
|
|||||||
# input
|
# input
|
||||||
if sys.stdin in r:
|
if sys.stdin in r:
|
||||||
try:
|
try:
|
||||||
msgBytes = self.readAll(sys.stdin.fileno(), len=4096)
|
msgBytes = self.readAll(sys.stdin.fileno())
|
||||||
except (EOFError, OSError):
|
except (EOFError, OSError):
|
||||||
active.value = False
|
active.value = False
|
||||||
break
|
break
|
||||||
@ -194,7 +193,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(), interruptFd=sys.stdin.fileno(), timeout = 0.5)
|
msgBytes = self.readAll(self.p_out.fileno(), interruptFd=sys.stdin.fileno())
|
||||||
except (EOFError, OSError):
|
except (EOFError, OSError):
|
||||||
active.value = False
|
active.value = False
|
||||||
break
|
break
|
||||||
|
Loading…
Reference in New Issue
Block a user