Skip to content

Commit 20f4bd4

Browse files
committed
Issue #21619: Try to fix test_broken_pipe_cleanup()
1 parent f7f3b0a commit 20f4bd4

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Lib/test/test_subprocess.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2523,13 +2523,16 @@ def test_invalid_args(self):
25232523

25242524
def test_broken_pipe_cleanup(self):
25252525
"""Broken pipe error should not prevent wait() (Issue 21619)"""
2526-
proc = subprocess.Popen([sys.executable, "-c",
2527-
"import sys;"
2528-
"sys.stdin.close();"
2529-
"sys.stdout.close();" # Signals that input pipe is closed
2530-
], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
2526+
args = [sys.executable, "-c",
2527+
"import sys;"
2528+
"sys.stdin.close();"
2529+
"sys.stdout.close();"] # Signals that input pipe is closed
2530+
proc = subprocess.Popen(args,
2531+
stdin=subprocess.PIPE,
2532+
stdout=subprocess.PIPE,
2533+
bufsize=support.PIPE_MAX_SIZE*2)
25312534
proc.stdout.read() # Make sure subprocess has closed its input
2532-
proc.stdin.write(b"buffered data")
2535+
proc.stdin.write(b"x" * support.PIPE_MAX_SIZE)
25332536
self.assertIsNone(proc.returncode)
25342537
self.assertRaises(OSError, proc.__exit__, None, None, None)
25352538
self.assertEqual(0, proc.returncode)

0 commit comments

Comments
 (0)