Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4895)

Side by Side Diff: Doc/library/subprocess.rst

Issue 12044: subprocess.Popen.__exit__ doesn't wait for process end
Patch Set: Created 2 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Lib/subprocess.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 :mod:`subprocess` --- Subprocess management 1 :mod:`subprocess` --- Subprocess management
2 =========================================== 2 ===========================================
3 3
4 .. module:: subprocess 4 .. module:: subprocess
5 :synopsis: Subprocess management. 5 :synopsis: Subprocess management.
6 .. moduleauthor:: Peter Åstrand <astrand@lysator.liu.se> 6 .. moduleauthor:: Peter Åstrand <astrand@lysator.liu.se>
7 .. sectionauthor:: Peter Åstrand <astrand@lysator.liu.se> 7 .. sectionauthor:: Peter Åstrand <astrand@lysator.liu.se>
8 8
9 9
10 The :mod:`subprocess` module allows you to spawn new processes, connect to their 10 The :mod:`subprocess` module allows you to spawn new processes, connect to their
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 This feature is only available if Python is built with universal newline 212 This feature is only available if Python is built with universal newline
213 support (the default). Also, the newlines attribute of the file objects 213 support (the default). Also, the newlines attribute of the file objects
214 :attr:`stdout`, :attr:`stdin` and :attr:`stderr` are not updated by the 214 :attr:`stdout`, :attr:`stdin` and :attr:`stderr` are not updated by the
215 :meth:`communicate` method. 215 :meth:`communicate` method.
216 216
217 If given, *startupinfo* will be a :class:`STARTUPINFO` object, which is 217 If given, *startupinfo* will be a :class:`STARTUPINFO` object, which is
218 passed to the underlying ``CreateProcess`` function. 218 passed to the underlying ``CreateProcess`` function.
219 *creationflags*, if given, can be :data:`CREATE_NEW_CONSOLE` or 219 *creationflags*, if given, can be :data:`CREATE_NEW_CONSOLE` or
220 :data:`CREATE_NEW_PROCESS_GROUP`. (Windows only) 220 :data:`CREATE_NEW_PROCESS_GROUP`. (Windows only)
221 221
222 Popen objects are supported as context managers via the :keyword:`with` state ment, 222 Popen objects are supported as context managers via the :keyword:`with` state ment:
223 closing any open file descriptors on exit. 223 on exit, standard file descriptors are closed, and the process is waited for.
224 :: 224 ::
225 225
226 with Popen(["ifconfig"], stdout=PIPE) as proc: 226 with Popen(["ifconfig"], stdout=PIPE) as proc:
227 log.write(proc.stdout.read()) 227 log.write(proc.stdout.read())
228 228
229 .. note::
230
231 In the initial implementation, the process was not automatically waited
232 for upon exit from the context manager. Code intending to be compatible
233 with Python 2.7.1 and earlier should explicitly call :meth:`Popen.wait`.
234
229 .. versionchanged:: 3.2 235 .. versionchanged:: 3.2
230 Added context manager support. 236 Added context manager support.
231 237
232 238
233 .. data:: DEVNULL 239 .. data:: DEVNULL
234 240
235 Special value that can be used as the *stdin*, *stdout* or *stderr* argument 241 Special value that can be used as the *stdin*, *stdout* or *stderr* argument
236 to :class:`Popen` and indicates that the special file :data:`os.devnull` 242 to :class:`Popen` and indicates that the special file :data:`os.devnull`
237 will be used. 243 will be used.
238 244
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 4. Backslashes are interpreted literally, unless they 868 4. Backslashes are interpreted literally, unless they
863 immediately precede a double quotation mark. 869 immediately precede a double quotation mark.
864 870
865 5. If backslashes immediately precede a double quotation mark, 871 5. If backslashes immediately precede a double quotation mark,
866 every pair of backslashes is interpreted as a literal 872 every pair of backslashes is interpreted as a literal
867 backslash. If the number of backslashes is odd, the last 873 backslash. If the number of backslashes is odd, the last
868 backslash escapes the next double quotation mark as 874 backslash escapes the next double quotation mark as
869 described in rule 3. 875 described in rule 3.
870 876
871 877
OLDNEW
« no previous file with comments | « no previous file | Lib/subprocess.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7