MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _stdin_write

Method _stdin_write

tools/python-3.11.9-amd64/Lib/subprocess.py:1140–1163  ·  view source on GitHub ↗
(self, input)

Source from the content-addressed store, hash-verified

1138 return self._devnull
1139
1140 def _stdin_write(self, input):
1141 if input:
1142 try:
1143 self.stdin.write(input)
1144 except BrokenPipeError:
1145 pass # communicate() must ignore broken pipe errors.
1146 except OSError as exc:
1147 if exc.errno == errno.EINVAL:
1148 # bpo-19612, bpo-30418: On Windows, stdin.write() fails
1149 # with EINVAL if the child process exited or if the child
1150 # process is still running but closed the pipe.
1151 pass
1152 else:
1153 raise
1154
1155 try:
1156 self.stdin.close()
1157 except BrokenPipeError:
1158 pass # communicate() must ignore broken pipe errors.
1159 except OSError as exc:
1160 if exc.errno == errno.EINVAL:
1161 pass
1162 else:
1163 raise
1164
1165 def communicate(self, input=None, timeout=None):
1166 """Interact with process: Send data to stdin and close it.

Callers 2

communicateMethod · 0.95
_communicateMethod · 0.95

Calls 2

writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected