diff options
author | Ross Lagerwall <rosslagerwall@gmail.com> | 2011-04-05 15:34:00 +0200 |
---|---|---|
committer | Ross Lagerwall <rosslagerwall@gmail.com> | 2011-04-05 15:34:00 +0200 |
commit | 4f61b025203cf3fcd52eab2ece0d3f60b0bacd48 (patch) | |
tree | f7bc0f55a08c6b4fc78fd4b98eff419a802306e2 /Lib/test | |
parent | 45fdb457da43da417796c465ebac3cec0beeb1bf (diff) | |
download | cpython-git-4f61b025203cf3fcd52eab2ece0d3f60b0bacd48.tar.gz |
Issue #10963: Ensure that subprocess.communicate() never raises EPIPE.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_subprocess.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index 837bdb50a4..20b72e69ce 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -592,6 +592,25 @@ class ProcessTestCase(BaseTestCase): 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(b"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(b"x" * 2**20) + # # POSIX tests # |