summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjquast <contact@jeffquast.com>2014-05-24 23:23:48 -0700
committerjquast <contact@jeffquast.com>2014-05-24 23:23:48 -0700
commit6dcab44c59afcbea57ea2d7b4ff71feddd1b7f4b (patch)
tree967de5b88dd0974d8be1a184f7d54014d860457f
parent0fe5aac4d602aa526ffa99b5a47ff25a1ee8ed3f (diff)
downloadpexpect-issue-20-travis-improving.tar.gz
try a 'death' workaround -- cannot reproduce locallyissue-20-travis-improving
only on travis-ci. presumably because it has load issues. so what we'll do, is even though we've just called select(2), with nothing to read, and waitpid(2) tells us the child is dead -- select(2) *again*, for any more data. it would then return, and the *next* call, ehcking waitpid(2), would indicate EOF. Otherwise, still the 'Very slow platform' EOF is raised.
-rw-r--r--pexpect/__init__.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/pexpect/__init__.py b/pexpect/__init__.py
index 8017123..db47a5b 100644
--- a/pexpect/__init__.py
+++ b/pexpect/__init__.py
@@ -906,6 +906,7 @@ class spawn(object):
raise EOF('End Of File (EOF). Slow platform.')
stime = time.time()
+ death = False
while True:
r, w, e = self.__select([self.child_fd], [], [], poll_exit)
elapsed = time.time() - stime
@@ -917,6 +918,10 @@ class spawn(object):
# (pid, status) from waitpid(2) until at least one additional
# call to select(2) is issued. Therefor, we poll every
# `poll_exit` interval for waitpid() which may cause EOF.
+ death = True
+ # poll at least just one more time for output
+ poll_exit = 0
+ elif death:
self.flag_eof = True
raise EOF('End of File (EOF). Very slow platform.')
elif timeout is not None: