While it would seem logical, the documentation does not explicitly state it:
Interact with process: Send data to stdin. Read data from stdout and stderr, until end-of-file is reached. Wait for process to terminate.
From looking at the source I think the answer is yes:
when timeout is None, communicate()
calls self._stdin_write(input)
https://github.com/python/cpython/blob/master/Lib/subprocess.py#L826-L827
otherwise _communicate()
calls self._stdin_write(input)
https://github.com/python/cpython/blob/master/Lib/subprocess.py#L1078-L1079
in each case _stdin_write()
calls self.stdin.close()
after self.stdin.write(input)
https://github.com/python/cpython/blob/master/Lib/subprocess.py#L793
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With