diff options
author | Gregory P. Smith <greg@mad-scientist.com> | 2011-02-05 21:51:27 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@mad-scientist.com> | 2011-02-05 21:51:27 (GMT) |
commit | 8095b6548b3b0e69fc24574ca56ac8654495f4ec (patch) | |
tree | 37543c04bf01fa62ac6f744ba5e367960946492a | |
parent | f7ef4de3d5e1a9dc4b4ff29d447901def678a7fc (diff) | |
download | cpython-8095b6548b3b0e69fc24574ca56ac8654495f4ec.zip cpython-8095b6548b3b0e69fc24574ca56ac8654495f4ec.tar.gz cpython-8095b6548b3b0e69fc24574ca56ac8654495f4ec.tar.bz2 |
Merged revisions 88352 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r88352 | gregory.p.smith | 2011-02-05 13:47:25 -0800 (Sat, 05 Feb 2011) | 3 lines
issue7678 - Properly document how to replace a shell pipeline so that SIGPIPE
happens when the end exits before the beginning.
........
-rw-r--r-- | Doc/library/subprocess.rst | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst index c490203..e333309 100644 --- a/Doc/library/subprocess.rst +++ b/Doc/library/subprocess.rst @@ -465,8 +465,11 @@ Replacing shell pipeline ==> p1 = Popen(["dmesg"], stdout=PIPE) p2 = Popen(["grep", "hda"], stdin=p1.stdout, stdout=PIPE) + p1.stdout.close() # Allow p1 to receive a SIGPIPE if p2 exits. output = p2.communicate()[0] +The p1.stdout.close() call after starting the p2 is important in order for p1 +to receive a SIGPIPE if p2 exits before p1. Replacing :func:`os.system` ^^^^^^^^^^^^^^^^^^^^^^^^^^^ |