Popen.wait() 要防止死锁
Warning: This will deadlock when using stdout=PIPE and/or stderr=PIPE and the child process generates enough output to a pipe such that it blocks waiting for the OS pipe buffer to accept more data. Use communicate() to avoid that.
本文探讨了在使用Python的subprocess模块时如何避免因Popen.wait()而导致的死锁问题,特别是在stdout=PIPE和/或stderr=PIPE的情况下,当子进程产生的输出过多时,可能会阻塞等待操作系统管道缓冲区接受更多数据。建议使用communicate()方法来规避这一问题。
Warning: This will deadlock when using stdout=PIPE and/or stderr=PIPE and the child process generates enough output to a pipe such that it blocks waiting for the OS pipe buffer to accept more data. Use communicate() to avoid that.
3682
953
1767
1139
741

被折叠的 条评论
为什么被折叠?
