Write to the program's stdin in response to patterns in ``buffer_``. The patterns and responses are driven by the `.StreamWatcher` instances from the ``watchers`` kwarg of `run` - see :doc:`/concepts/watchers` for a conceptual overview. :param buffer:
(self, buffer_: List[str])
| 930 | return (not self.using_pty) and isatty(input_) |
| 931 | |
| 932 | def respond(self, buffer_: List[str]) -> None: |
| 933 | """ |
| 934 | Write to the program's stdin in response to patterns in ``buffer_``. |
| 935 | |
| 936 | The patterns and responses are driven by the `.StreamWatcher` instances |
| 937 | from the ``watchers`` kwarg of `run` - see :doc:`/concepts/watchers` |
| 938 | for a conceptual overview. |
| 939 | |
| 940 | :param buffer: |
| 941 | The capture buffer for this thread's particular IO stream. |
| 942 | |
| 943 | :returns: ``None``. |
| 944 | |
| 945 | .. versionadded:: 1.0 |
| 946 | """ |
| 947 | # Join buffer contents into a single string; without this, |
| 948 | # StreamWatcher subclasses can't do things like iteratively scan for |
| 949 | # pattern matches. |
| 950 | # NOTE: using string.join should be "efficient enough" for now, re: |
| 951 | # speed and memory use. Should that become false, consider using |
| 952 | # StringIO or cStringIO (tho the latter doesn't do Unicode well?) which |
| 953 | # is apparently even more efficient. |
| 954 | stream = "".join(buffer_) |
| 955 | for watcher in self.watchers: |
| 956 | for response in watcher.submit(stream): |
| 957 | self.write_proc_stdin(response) |
| 958 | |
| 959 | def generate_env( |
| 960 | self, env: Dict[str, Any], replace_env: bool |
no test coverage detected