python: nonblocking subprocess, check stdout

风流意气都作罢 提交于 2019-11-29 02:34:50

Basically you have 3 options:

  1. Use threading to read in another thread without blocking the main thread.
  2. select on stdout, stderr instead of communicate. This way you can read just when data is available and avoid blocking.
  3. Let a library solve this, twisted is a obvious choice.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!