File size: 331 Bytes
0163a2c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import io
import sys
import subprocess
ps = subprocess.Popen(
[sys.executable, "-u", "./sub.py"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT
)
reader = io.TextIOWrapper(ps.stdout, encoding='utf8')
while ps.poll() is None:
char = reader.read(1)
if char == '\n':
print('break')
sys.stdout.write(char)
|