diff options
author | David Cullen <david.cullen@technicolor.com> | 2016-06-29 15:28:52 -0400 |
---|---|---|
committer | David Cullen <david.cullen@technicolor.com> | 2016-06-29 15:28:52 -0400 |
commit | 4dceb03560738ffba17a9a8e0558cf4a640fbbee (patch) | |
tree | cc17451beb39893ab6eaaa23a3934cdb152f1236 | |
parent | a0f5cf5feeb8f0c7eda223939f5810db258c77e5 (diff) | |
download | pexpect-4dceb03560738ffba17a9a8e0558cf4a640fbbee.tar.gz |
Further improve docstring for read_nonblocking.
-rw-r--r-- | pexpect/fdpexpect.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/pexpect/fdpexpect.py b/pexpect/fdpexpect.py index 785bc10..40817b9 100644 --- a/pexpect/fdpexpect.py +++ b/pexpect/fdpexpect.py @@ -115,10 +115,18 @@ class fdspawn(SpawnBase): self.write(s) def read_nonblocking(self, size=1, timeout=-1): - """The read_nonblocking method of SpawnBase assumes that a call to + """ Read from the file descriptor and return the result as a string. + + The read_nonblocking method of SpawnBase assumes that a call to os.read will not block. This is not the case for POSIX file like objects like sockets and serial ports. So we use select to implement - the timeout on POSIX.""" + the timeout on POSIX. + + :param size: Read at most size bytes + :param timeout: Wait timeout seconds for file descriptor to be ready + to read. If -1, use self.timeout. If 0, poll. + :return: String containing the bytes read + """ if os.name == 'posix': if timeout == -1: timeout = self.timeout |