Send data to the subprocess' stdin. Returns the number of bytes written.
(self, s)
| 130 | self.send(s) |
| 131 | |
| 132 | def send(self, s): |
| 133 | '''Send data to the subprocess' stdin. |
| 134 | |
| 135 | Returns the number of bytes written. |
| 136 | ''' |
| 137 | s = self._coerce_send_string(s) |
| 138 | self._log(s, 'send') |
| 139 | |
| 140 | b = self._encoder.encode(s, final=False) |
| 141 | if PY3: |
| 142 | return self.proc.stdin.write(b) |
| 143 | else: |
| 144 | # On Python 2, .write() returns None, so we return the length of |
| 145 | # bytes written ourselves. This assumes they all got written. |
| 146 | self.proc.stdin.write(b) |
| 147 | return len(b) |
| 148 | |
| 149 | def sendline(self, s=''): |
| 150 | '''Wraps send(), sending string ``s`` to child process, with os.linesep |
no test coverage detected