Update terminalManagement

This commit is contained in:
chrys87 2017-08-23 09:28:35 +02:00 committed by GitHub
parent ba897fbc4f
commit b0e920207e

View File

@ -57,12 +57,12 @@ def convert_to_text(dump):
def HandleTerminal(): def HandleTerminal():
debug = False debug = False
running = True running = True
attr = termios.tcgetattr(sys.stdin.fileno()) #attr = termios.tcgetattr(sys.stdin.fileno())
try: try:
tty.setraw(0) tty.setraw(0)
terminal, p_pid, p_out = open_terminal() terminal, p_pid, p_out = open_terminal()
termios.tcdrain(p_pid) #termios.tcdrain(p_pid)
termios.tcdrain(0) #termios.tcdrain(0)
while running: while running:
r, w, x = select.select([sys.stdin, p_out],[],[],0) r, w, x = select.select([sys.stdin, p_out],[],[],0)
if r == []: if r == []:
@ -93,7 +93,7 @@ def HandleTerminal():
print(e) print(e)
running = False running = False
finally: finally:
termios.tcsetattr(0, termios.TCSADRAIN, attr) #termios.tcsetattr(0, termios.TCSADRAIN, attr)
p_out.close() p_out.close()
os.kill(p_pid, signal.SIGTERM) os.kill(p_pid, signal.SIGTERM)