Re: [問題subprocess的的stdout PIPE被佔住

看板Python作者 (kmkh)時間13年前 (2012/07/17 15:41), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/3 (看更多)
from "http://docs.python.org/library/subprocess.html" Note Do not use stdout=PIPE or stderr=PIPE with this function. As the pipes are not being read in the current process, the child process may block if it generates enough output to a pipe to fill up the OS pipe buffer. ... ubprocess.PIPE Special value that can be used as the stdin, stdout or stderr argument to Popen and indicates that a pipe to the standard stream should be opened. ※ 引述《guestone (抹茶拿鐵)》之銘言: : 想請問大家我想用subprocess去執行一外部指令 : 並用stdout.PIPE去接回傳 : 但今天如果指令執行不成功 沒有return控制權而一直佔住stdout.PIPE : 讓我無法用stdout.read()得到回去做判斷分析傳怎麼辦?? : 有沒有什麼好的解決方法? : 感謝~ : 以下是我用的指令 : ------------------------- : http://dpaste.com/761489/ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.137.89
文章代碼(AID): #1G1HSqCm (Python)
文章代碼(AID): #1G1HSqCm (Python)