fix double presence of input

This commit is contained in:
chrys 2018-03-24 02:33:21 +01:00
parent 8a4f2ac194
commit 3477e48b3b

View File

@ -63,7 +63,7 @@ class driver(screenDriver):
bytes += data bytes += data
return bytes return bytes
def has_more(self,fd): def has_more(self,fd):
r, w, e = select.select([fd], [], [], 0) r, w, e = select.select([fd], [], [], 0.02)
return (fd in r) return (fd in r)
def open_terminal(self,command="bash", columns=80, lines=24): def open_terminal(self,command="bash", columns=80, lines=24):
p_pid, master_fd = pty.fork() p_pid, master_fd = pty.fork()
@ -117,7 +117,6 @@ class driver(screenDriver):
except (EOFError, OSError): except (EOFError, OSError):
running = False running = False
break break
terminal.feed(msgBytes)
os.write(p_out.fileno(), msgBytes) os.write(p_out.fileno(), msgBytes)
if debug: if debug:
print('after stdin') print('after stdin')
@ -149,10 +148,13 @@ class driver(screenDriver):
#encText, encAttr =\ #encText, encAttr =\
# self.autoDecodeVCSA(content[4:], eventData['lines'], eventData['columns']) # self.autoDecodeVCSA(content[4:], eventData['lines'], eventData['columns'])
#print(content['lines'][0]) #print(content['lines'][0])
#print('pre',eventData['text'])
for line in content['lines']: for line in content['lines']:
#print('line',line)
for e in line: for e in line:
eventData['text'] += ''.join(e[0]) #print('loop|',e,'|')
print(eventData['text']) eventData['text'] += e[0]
#print('post',eventData['text'])
#eventData['text'] = '' #eventData['text'] = ''
return eventData.copy() return eventData.copy()