subprocess.Popen.stdout - reading stdout in real-time (again)

后端 未结 5 816
时光说笑
时光说笑 2020-12-09 19:12

Again, the same question.
The reason is - I still can\'t make it work after reading the following:

  • Real-time intercepting of stdout from another process in
5条回答
  •  抹茶落季
    2020-12-09 20:13

    The bufsize=256 argument prevents 12345\n from being sent to the child process in a chunk smaller than 256 bytes, as it will be when omitting bufsize or inserting p.stdin.flush() after p.stdin.write(). Default behaviour is line-buffering.

    In either case you should at least see one empty line before blocking as emitted by the first printf(\n...) in your example.

提交回复
热议问题