Skip to content

Commit de856d9

Browse files
committed
gh-141473: Fix subprocess.Popen.communicate to send input to stdin
1 parent 759a048 commit de856d9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/subprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2105,7 +2105,7 @@ def _communicate(self, input, endtime, orig_timeout):
21052105
input_view = memoryview(self._input)
21062106

21072107
with _PopenSelector() as selector:
2108-
if self.stdin and input:
2108+
if self.stdin and not self.stdin.closed and self._input:
21092109
selector.register(self.stdin, selectors.EVENT_WRITE)
21102110
if self.stdout and not self.stdout.closed:
21112111
selector.register(self.stdout, selectors.EVENT_READ)

0 commit comments

Comments
 (0)