MCPcopy Index your code
hub / github.com/python/cpython / _stdin_write

Method _stdin_write

Lib/subprocess.py:1205–1228  ·  view source on GitHub ↗
(self, input)

Source from the content-addressed store, hash-verified

1203 return self._devnull
1204
1205 def _stdin_write(self, input):
1206 if input:
1207 try:
1208 self.stdin.write(input)
1209 except BrokenPipeError:
1210 pass # communicate() must ignore broken pipe errors.
1211 except OSError as exc:
1212 if exc.errno == errno.EINVAL:
1213 # bpo-19612, bpo-30418: On Windows, stdin.write() fails
1214 # with EINVAL if the child process exited or if the child
1215 # process is still running but closed the pipe.
1216 pass
1217 else:
1218 raise
1219
1220 try:
1221 self.stdin.close()
1222 except BrokenPipeError:
1223 pass # communicate() must ignore broken pipe errors.
1224 except OSError as exc:
1225 if exc.errno == errno.EINVAL:
1226 pass
1227 else:
1228 raise
1229
1230 def communicate(self, input=None, timeout=None):
1231 """Interact with process: Send data to stdin and close it.

Callers 2

communicateMethod · 0.95
_writerthreadMethod · 0.95

Calls 2

writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected