Re: [問題] threading / read from pipe的內容不完整

看板Python作者 (我抓得到什麼呢?)時間12年前 (2011/07/18 12:55), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
找到問題了... 沒有東西被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
文章代碼(AID): #1E8xp4hF (Python)
文章代碼(AID): #1E8xp4hF (Python)