diff options
author | Thomas Kluyver <takowl@gmail.com> | 2014-01-23 15:36:39 -0800 |
---|---|---|
committer | Thomas Kluyver <takowl@gmail.com> | 2014-01-23 15:36:39 -0800 |
commit | bb6ba03af13f8b3adfc64c3986ca522f634befbc (patch) | |
tree | d79e109c02094ad02f187645b468cde595b63e12 | |
parent | 13ec3b0e134159d0168811862a9d7980847ca4e0 (diff) | |
download | pexpect-bb6ba03af13f8b3adfc64c3986ca522f634befbc.tar.gz |
Fix documentation of using auto_prompt_reset.
Closes gh-35
-rw-r--r-- | doc/api/pxssh.rst | 11 | ||||
-rw-r--r-- | pexpect/pxssh.py | 7 |
2 files changed, 6 insertions, 12 deletions
diff --git a/doc/api/pxssh.rst b/doc/api/pxssh.rst index c3388f0..bc20229 100644 --- a/doc/api/pxssh.rst +++ b/doc/api/pxssh.rst @@ -12,18 +12,13 @@ pxssh class .. automethod:: __init__ - .. attribute:: auto_prompt_reset - - Set this to False to prevent :meth:`login` from setting a unique prompt - which can easily be located. - .. attribute:: PROMPT - The regex pattern to search for to find the prompt. If - :attr:`auto_prompt_reset` is False, you must set this attribute manually. + The regex pattern to search for to find the prompt. If you call :meth:`login` + with ``auto_prompt_reset=False``, you must set this attribute manually. .. automethod:: login .. automethod:: logout .. automethod:: prompt .. automethod:: sync_original_prompt - .. automethod:: set_unique_prompt
\ No newline at end of file + .. automethod:: set_unique_prompt diff --git a/pexpect/pxssh.py b/pexpect/pxssh.py index a068625..7c187d4 100644 --- a/pexpect/pxssh.py +++ b/pexpect/pxssh.py @@ -118,7 +118,6 @@ class pxssh (spawn): # Unsetting SSH_ASKPASS on the remote side doesn't disable it! Annoying! #self.SSH_OPTS = "-x -o'RSAAuthentication=no' -o 'PubkeyAuthentication=no'" self.force_password = False - self.auto_prompt_reset = True def levenshtein_distance(self, a,b): @@ -233,7 +232,7 @@ class pxssh (spawn): then login() raises an :class:`ExceptionPxssh` exception. In some situations it is not possible or desirable to reset the - original prompt. In this case, set :attr:`auto_prompt_reset` to False to + original prompt. In this case, pass ``auto_prompt_reset=False`` to inhibit setting the prompt to the UNIQUE_PROMPT. Remember that pxssh uses a unique prompt in the prompt() method. If the original prompt is not reset then this will disable the prompt() method unless you @@ -333,12 +332,12 @@ class pxssh (spawn): self.expect(EOF) self.close() - def prompt (self, timeout=-1): + def prompt(self, timeout=-1): '''This matches the shell prompt. This is little more than a short-cut to the expect() method. This returns True if the shell prompt was matched. This returns False if a timeout was raised. Note that if you - called :meth:`login` with :attr:`auto_prompt_reset` set to False then + called :meth:`login` with ``auto_prompt_reset=False`` then before calling :meth:`prompt` you must set the :attr:`PROMPT` attribute to a regex that it will use for matching the prompt. |