Update terminalManagement
This commit is contained in:
		@@ -53,10 +53,7 @@ def HandleTerminal():
 | 
			
		||||
        tty.setraw(0)
 | 
			
		||||
        terminal, p_pid, p_out = open_terminal()
 | 
			
		||||
        std_out = os.fdopen(sys.stdout.fileno(), "w+b", 0)
 | 
			
		||||
        #termios.tcdrain(p_pid)
 | 
			
		||||
        #termios.tcdrain(0)
 | 
			
		||||
        while running:
 | 
			
		||||
            #time.sleep(0.04)
 | 
			
		||||
            r, w, x = select.select([sys.stdin, p_out],[],[])
 | 
			
		||||
            if r == []:
 | 
			
		||||
                continue
 | 
			
		||||
@@ -65,9 +62,6 @@ def HandleTerminal():
 | 
			
		||||
                    print('pre p_out')                                            
 | 
			
		||||
                try:
 | 
			
		||||
                    msgBytes = read_all(p_out.fileno())
 | 
			
		||||
                    #msgBytes = p_out.read(65536)
 | 
			
		||||
                    #msgBytes = os.read(p_out.fileno(), 4)                 
 | 
			
		||||
                    #p_out.read(4096)
 | 
			
		||||
                except (EOFError, OSError):
 | 
			
		||||
                    running = False
 | 
			
		||||
                    break
 | 
			
		||||
@@ -82,13 +76,9 @@ def HandleTerminal():
 | 
			
		||||
                    print('pre stdin')       
 | 
			
		||||
                try:
 | 
			
		||||
                    msgBytes = read_all(sys.stdin.fileno())
 | 
			
		||||
                    #msgBytes = p_out.read(65536)
 | 
			
		||||
                    #msgBytes = os.read(p_out.fileno(), 4)                 
 | 
			
		||||
                    #p_out.read(4096)
 | 
			
		||||
                except (EOFError, OSError):
 | 
			
		||||
                    running = False                    
 | 
			
		||||
                    break
 | 
			
		||||
                #msgBytes = os.read(sys.stdin.fileno(), 1)
 | 
			
		||||
                terminal.feed(msgBytes)            
 | 
			
		||||
                os.write(p_out.fileno(), msgBytes)
 | 
			
		||||
                if debug:
 | 
			
		||||
@@ -97,7 +87,6 @@ def HandleTerminal():
 | 
			
		||||
        print(e)
 | 
			
		||||
        running = False
 | 
			
		||||
    finally:
 | 
			
		||||
        #termios.tcsetattr(0, termios.TCSADRAIN, attr)              
 | 
			
		||||
        os.kill(p_pid, signal.SIGTERM)
 | 
			
		||||
        p_out.close()    
 | 
			
		||||
        termios.tcsetattr(sys.stdin, termios.TCSADRAIN, old_attr)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user