Message227147
unbuffer works for me. It fakes a tty, so apt-get doesn't automatically enter quiet mode.
import io
import subprocess
args = ['unbuffer', 'apt-get', 'download', 'firefox']
p = subprocess.Popen(args,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
out = io.TextIOWrapper(p.stdout, newline='')
while True:
c = out.read(1)
if c == '':
break
print(c, end='', flush=True)
p.wait()
unbuffer isn't required if you disable quiet mode as follows:
args = ['apt-get', '-q=0', 'download', 'firefox'] |
|
Date |
User |
Action |
Args |
2014-09-20 06:56:37 | eryksun | set | recipients:
+ eryksun, vstinner, akira, Sworddragon |
2014-09-20 06:56:37 | eryksun | set | messageid: <1411196197.53.0.434323502223.issue22443@psf.upfronthosting.co.za> |
2014-09-20 06:56:37 | eryksun | link | issue22443 messages |
2014-09-20 06:56:37 | eryksun | create | |
|