[Python-checkins] r88353 - in python/branches/release27-maint: Doc/library/subprocess.rst

gregory.p.smith python-checkins at python.org
Sat Feb 5 22:49:56 CET 2011


Author: gregory.p.smith
Date: Sat Feb  5 22:49:56 2011
New Revision: 88353

Log:
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.
........


Modified:
   python/branches/release27-maint/   (props changed)
   python/branches/release27-maint/Doc/library/subprocess.rst

Modified: python/branches/release27-maint/Doc/library/subprocess.rst
==============================================================================
--- python/branches/release27-maint/Doc/library/subprocess.rst	(original)
+++ python/branches/release27-maint/Doc/library/subprocess.rst	Sat Feb  5 22:49:56 2011
@@ -450,8 +450,11 @@
    ==>
    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`
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^


More information about the Python-checkins mailing list