Getting realtime output using subprocess

前端 未结 18 2899
执笔经年
执笔经年 2020-11-22 10:12

I am trying to write a wrapper script for a command line program (svnadmin verify) that will display a nice progress indicator for the operation. This requires me to be abl

18条回答
  •  感动是毒
    2020-11-22 11:01

    p = subprocess.Popen(cmd, stdout=subprocess.PIPE, bufsize=1)
    for line in iter(p.stdout.readline, b''):
        print line,
    p.stdout.close()
    p.wait()
    

提交回复
热议问题