Skip to content

Instantly share code, notes, and snippets.

View 510908220's full-sized avatar
🎯
Focusing

westdoorblowcola 510908220

🎯
Focusing
View GitHub Profile
@510908220
510908220 / subprocess-bufsize-test.py
Last active January 30, 2023 04:15 — forked from jaypei/subprocess-bufsize-test.py
使用subprocess。避免在子程序大量输出时因buffer size满,导致父进程hang住。
#!/usr/bin/python
# -*- coding: utf-8 -*-
import subprocess
from StringIO import StringIO
out = StringIO()
sp = subprocess.Popen(["python", "test_output.py"],
stdout=subprocess.PIPE,