Message127787
The docs should be updated. This has been noted in msg54949 and http://www.enricozini.org/2009/debian/python-pipes/
Perhaps this example will make it clear:
import subprocess
p1 = subprocess.Popen(["yes"], stdout=subprocess.PIPE)
p2 = subprocess.Popen(["head"], stdin=p1.stdout, stdout=subprocess.PIPE)
#p1.stdout.close()
p1.wait()
This example hangs. "yes" writes to "head" and head reads the first 10 lines and then exits. But, "yes" does not receive a SIGPIPE because the python process still has a p1.stdout open. Thus, p1.stdout should be closed after being passed to p2. |
|
Date |
User |
Action |
Args |
2011-02-03 10:01:32 | rosslagerwall | set | recipients:
+ rosslagerwall, gregory.p.smith, eric.araujo, steven.k.wong, docs@python |
2011-02-03 10:01:32 | rosslagerwall | set | messageid: <1296727292.25.0.826363818484.issue7678@psf.upfronthosting.co.za> |
2011-02-03 10:01:29 | rosslagerwall | link | issue7678 messages |
2011-02-03 10:01:29 | rosslagerwall | create | |
|