real time subprocess.Popen via stdout and PIPE

前端 未结 8 1444

I am trying to grab stdout from a subprocess.Popen call and although I am achieving this easily by doing:

cmd = subprocess.Popen(\'         


        
8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-30 05:42

    Drop the readlines() which is coalescing the output. Also you'll need to enforce line buffering since most commands will interally buffer output to a pipe. For details see: http://www.pixelbeat.org/programming/stdio_buffering/

提交回复
热议问题