Fix #10554. Added context manager support to Popen objects.
Added a few common Popen uses to the tests like we've done for a few other
instances of adding context managers. Eventually the entire test suite
could be converted to use the context manager format.
diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst
index 8f9b9ea..e0bb163 100644
--- a/Doc/library/subprocess.rst
+++ b/Doc/library/subprocess.rst
@@ -208,6 +208,16 @@
underlying CreateProcess() function. They can specify things such as appearance
of the main window and priority for the new process. (Windows only)
+ Popen objects are supported as context managers via the :keyword:`with` statement,
+ closing any open file descriptors on exit.
+ ::
+
+ with Popen(["ifconfig"], stdout=PIPE) as proc:
+ log.write(proc.stdout.read())
+
+ .. versionchanged:: 3.2
+ Added context manager support.
+
.. data:: PIPE