看板 Python 關於我們 聯絡資訊
找到問題了... 沒有東西被block掉 def reading(): while True: scr=Conn.stdout.read(1) drop=sys.stdout.buffer.write(scr) => drop=sys.stdout.flush() <= DataIn=threading.Thread(target=reading) DataIn.start() 在interactive shell裡寫東西到stdout,不用flush就看的到了 perhaps python implicitly flushed stdout before giving prompt..... 而且這個buffer不是OS的buffer... 看strace想了好久才搞定 = =" { python先呼叫了select(),在interactive shell收到return後才write 而不是停在read(pipe)時} -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.245.32