(self, input)
| 1149 | return self._devnull |
| 1150 | |
| 1151 | def _stdin_write(self, input): |
| 1152 | if input: |
| 1153 | try: |
| 1154 | self.stdin.write(input) |
| 1155 | except BrokenPipeError: |
| 1156 | pass # communicate() must ignore broken pipe errors. |
| 1157 | except OSError as exc: |
| 1158 | if exc.errno == errno.EINVAL: |
| 1159 | # bpo-19612, bpo-30418: On Windows, stdin.write() fails |
| 1160 | # with EINVAL if the child process exited or if the child |
| 1161 | # process is still running but closed the pipe. |
| 1162 | pass |
| 1163 | else: |
| 1164 | raise |
| 1165 | |
| 1166 | try: |
| 1167 | self.stdin.close() |
| 1168 | except BrokenPipeError: |
| 1169 | pass # communicate() must ignore broken pipe errors. |
| 1170 | except OSError as exc: |
| 1171 | if exc.errno == errno.EINVAL: |
| 1172 | pass |
| 1173 | else: |
| 1174 | raise |
| 1175 | |
| 1176 | def communicate(self, input=None, timeout=None): |
| 1177 | """Interact with process: Send data to stdin and close it. |
no test coverage detected