summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* more naughty attempts, cleaning up, as not to loseissue-20-try-2jquast2014-05-254-44/+83
|
* Issue #20: Strange EOF/TIMEOUT behaviorjquast2014-05-244-13/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem ------- When running a subprocess that writes a lot of data to stdout, then exits, it is possible to read all data from stdout, then, when calling waitpid(2), to be told the subprocess has not yet exited. pexpect would then call read_nonblocking and block for a full 30 seconds, because there remains no more data on stdout. Solution -------- Add new parameter, poll_exit to read_nonblocking so that select(2) is called at shorter intervals than previously done, but still up until timeout specified, doing a poll for waitpid(2) at regular intervals. This ensures that no longer than (default, 0.15) seconds elapse, instead of the default of 30. Testing ------- Includes travis changes for python3.4, also disabling use_site_packages which doesn't appear supported any longer (most builds have been failing for some time). Additionally, a 'death' flag for checking select(2) after waitpid(2) was necessary only for python3.4 on travis, i could not reproduce locally. All existing unit tests, of course. However, as a race condition, it is not possible to reliably reproduce, it may require anywhere from 1 to 5 minutes of looping to cause it to reproduce, so it was not put into base tests. A simple program was authored:: TIMEOUT=1 def test_2(): while True: stime = time.time() child = pexpect.spawn('ls -lR /dev', timeout=TIMEOUT) child.expect(pexpect.EOF) elapsed = time.time() - stime print('got eof in {0:0.2f} in pid {1}' .format(elapsed, child.pid)) assert math.floor(elapsed) < TIMEOUT, elapsed Without this change, this program will raise an exception after several dozen runs, hitting the race condition. With this change, I have been executing this program for several thousand iterations without failed assertion. PLEASE CONFER ------------- @takluyver, with this change, I think we may also delete the self.__irix_hack and its surrounding hack -- and even the first self.isalive() check just before this change, for "some systems such as Solaris" without any penalty in performance. What do you think?
* Merge pull request #53 from takluyver/rm-install-docThomas Kluyver2014-05-132-48/+4
|\ | | | | Remove out of date INSTALL doc
| * Remove out of date INSTALL docThomas Kluyver2014-05-132-48/+4
|/ | | | Closes gh-52
* Add long description (copied part of README)3.2Thomas Kluyver2014-04-141-0/+17
|
* Bump version number for 3.2Thomas Kluyver2014-04-142-3/+3
|
* Add release notes for 3.2Thomas Kluyver2014-04-131-0/+12
|
* Merge pull request #43 from pexpect/issue-42-cannot-implicit-bytes-to-strJeff Quast2014-03-072-3/+18
|\ | | | | closes issue #42, self.buffer decoded implicitly
| * display expected prompt as PROMPT, not PROMPT_SET_SHissue-42-cannot-implicit-bytes-to-strjquast2014-03-071-1/+1
| | | | | | | | completes issue #44; thanks to @takluyver for keen eye.
| * assertRaises is not 2.6->3.x compatiblejquast2014-03-061-1/+7
| |
| * closes issue #42, self.buffer decoded implicitlyjquast2014-03-062-3/+12
|/ | | | | | | | | | | | | | | | | | | create a unit tests which otherwise failed for python3 only: mock the return value of set_unique_prompt for a value of False, which causes ExceptionPxssh to raise. previously, displaying self.buffer within the exception causes bytes() to be implicitly decoded to str (unicode type in py3). python2 didn't care. it is implicitly decoded as 'ascii' encoding, without warning. Then, use the %r to represent it as b'xyz' in python3. Also, display what we expected to be more helpful for the user. What is actually happening here is the 'set PS1=' command is used so that pexpect can more regularly understand when the prompt is awaiting command input, and it is set to something more predictable. You'd be suprised what kind of hackery can happen to prompt values even if PS1 is explicitly set, especially in today's oh-my-zhs and git-prompt.sh extensions.
* Merge pull request #41 from chrismerck/patch-1Thomas Kluyver2014-02-201-14/+1
|\ | | | | FAQ.rst: Removed redundant paragraph.
| * FAQ.rst: Removed redundant paragraph.Chris Merck2014-02-201-14/+1
|/
* Merge pull request #40 from emaste/masterThomas Kluyver2014-02-131-11/+4
|\ | | | | Remove workaround for bug affecting very old platforms
| * Remove workaround for bug affecting very old platformsEd Maste2014-02-131-11/+4
|/ | | | https://github.com/pexpect/pexpect/issues/39
* Merge pull request #38 from mattprintz/masterThomas Kluyver2014-02-073-1/+63
|\ | | | | Bug: AttributeError: 'error' object has no attribute 'errno'
| * Fixing test for signal interrupt exceptionMatthew Printz2014-02-063-16/+31
| |
| * Adding test to for signal handling errorMatthew Printz2014-02-062-0/+47
| |
| * Simplifying code to use format of select.error arguments that works in both ↵Matthew Printz2014-02-051-5/+1
| | | | | | | | Py27 and Py3
| * Fixing issue where errno does not exist on select.errorMatthew Printz2014-02-041-1/+5
|/
* Merge pull request #36 from takluyver/pxssh-docsThomas Kluyver2014-01-272-61/+66
|\ | | | | Pxssh docs
| * Update pxssh example for Python 3Thomas Kluyver2014-01-231-10/+10
| |
| * Document force_password attributeThomas Kluyver2014-01-231-0/+6
| |
| * Polish pxssh docstringsThomas Kluyver2014-01-231-19/+27
| |
| * Make code style more regularThomas Kluyver2014-01-231-24/+21
| |
| * Fix documentation of using auto_prompt_reset.Thomas Kluyver2014-01-232-12/+6
|/ | | | Closes gh-35
* Prepare for 3.1 release3.1Thomas Kluyver2014-01-224-5/+176
|
* Squash some Sphinx warningsThomas Kluyver2014-01-221-1/+9
|
* Merge pull request #29 from takluyver/examples-main-blocksThomas Kluyver2014-01-077-70/+18
|\ | | | | Don't catch unhandled exceptions in examples.
| * Don't catch unhandled exceptions in examples.Thomas Kluyver2013-12-137-70/+18
| | | | | | | | Let Python handle printing a traceback and exiting in these cases.
* | Merge pull request #31 from takluyver/stdout-bytes-py3Thomas Kluyver2014-01-071-1/+8
|\ \ | | | | | | Allow importing when sys.stdout is reassigned on Python 3
| * | Allow importing when sys.stdout is reassigned on Python 3Thomas Kluyver2013-12-181-1/+8
| |/ | | | | | | Closes gh-30
* | Merge pull request #34 from offby1/masterThomas Kluyver2014-01-072-0/+15
|\ \ | | | | | | ExceptionPexpect.__init__: invoke super's init
| * | Test for previous commitEric Hanchrow2014-01-071-0/+14
| | |
| * | ExceptionPexpect.__init__: invoke super's initEric Hanchrow2014-01-061-0/+1
| |/ | | | | | | | | | | | | | | This avoids an exception in the following: import pexpect import pickle pickle.loads(pickle.dumps(pexpect.EOF('hey you')))
* | Merge pull request #33 from aho-iridium/masterThomas Kluyver2014-01-071-1/+1
|\ \ | |/ |/| Correctly handle when select in spawn returns with an error (e.g. SIGWINCH...
| * Correct handle when select in spawn returns with an error (e.g. SIGWINCH)Alex Ho2013-12-301-1/+1
|/
* Merge pull request #28 from joeledwards/masterThomas Kluyver2013-12-111-17/+54
|\ | | | | pxssh prompt synchronization and new parameters
| * Merge branch 'master' of github.com:joeledwards/pexpectJoel Edwards2013-12-110-0/+0
| |\ | | | | | | | | | | | | Conflicts: pexpect/pxssh.py
| | * Switched to a simpler approache for appending to the promptJoel Edwards2013-12-101-11/+3
| | | | | | | | | | | | in try_read_prompt thanks to a suggestion from takluyver
| | * Removed call to self._coerce_read_string in try_read_promptJoel Edwards2013-12-101-1/+1
| | | | | | | | | | | | | | | This was an artifact from my attempt at adding support for non ASCII character encodings in a prior commit.
| | * Removed coerce_result argument from pexpect read_nonblocking method.Joel Edwards2013-12-102-8/+4
| | |
| | * __init__.py (pexpect)Joel Edwards2013-12-102-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | - updated the read_nonblocking method to take a new boolean coerce_result argument pxssh.py - updated try_read_prompt to support python 2.x/3.x results from os.read (string/binary respectively)
| | * Cleaned up prompt synchronizationJoel Edwards2013-12-041-24/+36
| | |
| | * Added a control arguments to pxssh login methodJoel Edwards2013-11-151-14/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | - key verification for localhost - configurable quiet setting - synchronization multiplier for (very) slow connections Added new method (try_read_prompt) to pxssh for performing the prompt read quickly on fast connections while not failing on slower connections
| * | Cleanup of unused import and loop exit strategy in try_read_promptJoel Edwards2013-12-111-4/+1
| | |
| * | Switched to a simpler approache for appending to the promptJoel Edwards2013-12-111-11/+3
| | | | | | | | | | | | in try_read_prompt thanks to a suggestion from takluyver
| * | Removed call to self._coerce_read_string in try_read_promptJoel Edwards2013-12-111-1/+1
| | | | | | | | | | | | | | | This was an artifact from my attempt at adding support for non ASCII character encodings in a prior commit.
| * | Removed coerce_result argument from pexpect read_nonblocking method.Joel Edwards2013-12-112-8/+4
| | |
| * | __init__.py (pexpect)Joel Edwards2013-12-112-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | - updated the read_nonblocking method to take a new boolean coerce_result argument pxssh.py - updated try_read_prompt to support python 2.x/3.x results from os.read (string/binary respectively)