blob: 7f87716111d55cda9ef2b716b662a01cc5c27bc3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import subprocess
import threading
def popen_io(cmd):
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
consume_stream(p.stderr)
return p
def consume_stream(stream):
def consume(s):
for _ in s:
pass
threading.Thread(target=consume, args=(stream,)).start()
|