mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-141473: Fix subprocess.Popen.communicate to send input to stdin upon a subsequent post-timeout call (GH-141477)
* gh-141473: Fix subprocess.Popen.communicate to send input to stdin * Docs: Clarify that `input` is one time only on `communicate()` * NEWS entry * Add a regression test. --------- Co-authored-by: Gregory P. Smith <greg@krypto.org>
This commit is contained in:
parent
d2d2e92110
commit
526d7a8bb4
4 changed files with 42 additions and 2 deletions
|
|
@ -2105,7 +2105,7 @@ def _communicate(self, input, endtime, orig_timeout):
|
|||
input_view = memoryview(self._input)
|
||||
|
||||
with _PopenSelector() as selector:
|
||||
if self.stdin and input:
|
||||
if self.stdin and not self.stdin.closed and self._input:
|
||||
selector.register(self.stdin, selectors.EVENT_WRITE)
|
||||
if self.stdout and not self.stdout.closed:
|
||||
selector.register(self.stdout, selectors.EVENT_READ)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue