Issue #10963: Ensure that subprocess.communicate() never raises EPIPE.
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index 04eb9b1..b635ef3 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -597,6 +597,24 @@
self.assertFalse(os.path.exists(ofname))
self.assertFalse(os.path.exists(efname))
+ def test_communicate_epipe(self):
+ # Issue 10963: communicate() should hide EPIPE
+ p = subprocess.Popen([sys.executable, "-c", 'pass'],
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ self.addCleanup(p.stdout.close)
+ self.addCleanup(p.stderr.close)
+ self.addCleanup(p.stdin.close)
+ p.communicate("x" * 2**20)
+
+ def test_communicate_epipe_only_stdin(self):
+ # Issue 10963: communicate() should hide EPIPE
+ p = subprocess.Popen([sys.executable, "-c", 'pass'],
+ stdin=subprocess.PIPE)
+ self.addCleanup(p.stdin.close)
+ time.sleep(2)
+ p.communicate("x" * 2**20)
# context manager
class _SuppressCoreFiles(object):