- Issue #12044: Fixed subprocess.Popen when used as a context manager to
  wait for the process to end when exiting the context to avoid unintentionally
  leaving zombie processes around.
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index a7c68a5..cd8aa6b 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -796,6 +796,8 @@
             self.stderr.close()
         if self.stdin:
             self.stdin.close()
+        # Wait for the process to terminate, to avoid zombies.
+        self.wait()
 
     def __del__(self, _maxsize=sys.maxsize, _active=_active):
         if not self._child_created: