Message75211
>> Using a nonzero bufsize parameter makes all the difference in the
>> world:
...
In fact, looking at posix_popen in posixmodule.c it appears the default
value for bufsize there is -1, implying that I/O is fully buffered.
Even if the default bufsize value for subprocess.Popen is not changed its
documentation should be corrected to reflect the different default values
for bufsize between os.popen and subprocess.Popen:
Replacing os.popen*
-------------------
pipe = os.popen(cmd, mode='r', [bufsize])
==>
pipe = Popen(cmd, shell=True, bufsize=bufsize, stdout=PIPE).stdout
If you use the default bufsize with os.popen you must set bufsize to -1
when creating a Popen object. Otherwise your I/O will be unbuffered and
you will be disappointed at the I/O performance. |
|
Date |
User |
Action |
Args |
2008-10-25 14:11:34 | skip.montanaro | set | recipients:
+ skip.montanaro, georg.brandl, LambertDW, wplappert, sameerd |
2008-10-25 14:11:34 | skip.montanaro | set | messageid: <1224943894.12.0.925612464665.issue4194@psf.upfronthosting.co.za> |
2008-10-25 14:11:32 | skip.montanaro | link | issue4194 messages |
2008-10-25 14:11:32 | skip.montanaro | create | |
|