summaryrefslogtreecommitdiff
path: root/pexpect
diff options
context:
space:
mode:
authorThomas Kluyver <takowl@gmail.com>2015-09-22 14:58:39 +0100
committerThomas Kluyver <takowl@gmail.com>2015-09-22 14:58:39 +0100
commit49eb3baedbad8323f6c848e8d48f94063b350746 (patch)
treebf53eb188932f49ac555a1ef3591116f832e44cc /pexpect
parentcdcb7e69d5f82d81bdeefda05322167f1f92aaab (diff)
parent6a8e9b2ad73104740a48b0c8d6c9fd0cc2ae9e92 (diff)
downloadpexpect-git-49eb3baedbad8323f6c848e8d48f94063b350746.tar.gz
Merge pull request #253 from pexpect/docs-revision-2
docstring about timeout behavior
Diffstat (limited to 'pexpect')
-rw-r--r--pexpect/pty_spawn.py7
-rw-r--r--pexpect/spawnbase.py10
2 files changed, 13 insertions, 4 deletions
diff --git a/pexpect/pty_spawn.py b/pexpect/pty_spawn.py
index c398af4..0b9ad4c 100644
--- a/pexpect/pty_spawn.py
+++ b/pexpect/pty_spawn.py
@@ -85,6 +85,13 @@ class spawn(SpawnBase):
:meth:`~.expect` returns, the full buffer attribute remains up to
size *maxread* irrespective of *searchwindowsize* value.
+ When the keyword argument ``timeout`` is specified as a number,
+ (default: *30*), then :class:`TIMEOUT` will be raised after the value
+ specified has elapsed, in seconds, for any of the :meth:`~.expect`
+ family of method calls. When None, TIMEOUT will not be raised, and
+ :meth:`~.expect` may block indefinitely until match.
+
+
The logfile member turns on or off logging. All input and output will
be copied to the given file object. Set logfile to None to stop
logging. This is the default. Set logfile to sys.stdout to echo
diff --git a/pexpect/spawnbase.py b/pexpect/spawnbase.py
index aa7ef86..0518d83 100644
--- a/pexpect/spawnbase.py
+++ b/pexpect/spawnbase.py
@@ -251,7 +251,10 @@ class SpawnBase(object):
*before* is all data received up to the exception, while *match* and
*after* attributes are value None.
- If timeout is -1 then timeout will be set to the self.timeout value.
+ When the keyword argument timeout is -1 (default), then TIMEOUT will
+ raise after the default value specified by the class timeout
+ attribute. When None, TIMEOUT will not be raised and may block
+ indefinitely until match.
When the keyword argument searchwindowsize is -1 (default), then the
value specified by the class maxread attribute is used.
@@ -319,9 +322,8 @@ class SpawnBase(object):
expressions). This method is similar to the expect() method except that
expect_list() does not recompile the pattern list on every call. This
may help if you are trying to optimize for speed, otherwise just use
- the expect() method. This is called by expect(). If timeout==-1 then
- the self.timeout value is used. If searchwindowsize==-1 then the
- self.searchwindowsize value is used.
+ the expect() method. This is called by expect().
+
Like :meth:`expect`, passing ``async=True`` will make this return an
asyncio coroutine.