Skip to content

Commit

Permalink
Merge pull request #606 from eldipa/Issue605-Disable-Chaining-Timeout…
Browse files Browse the repository at this point in the history
…-EOF-Exception

Disable chaining Timeout and EOF exceptions
  • Loading branch information
Red-M committed Dec 17, 2019
2 parents fa6a556 + f98485a commit 692681f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pexpect/expect.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ def eof(self, err=None):
msg += '\nsearcher: %s' % self.searcher
if err is not None:
msg = str(err) + '\n' + msg
raise EOF(msg)

exc = EOF(msg)
exc.__cause__ = None # in Python 3.x we can use "raise exc from None"
raise exc

def timeout(self, err=None):
spawn = self.spawn
Expand All @@ -79,7 +82,10 @@ def timeout(self, err=None):
msg += '\nsearcher: %s' % self.searcher
if err is not None:
msg = str(err) + '\n' + msg
raise TIMEOUT(msg)

exc = TIMEOUT(msg)
exc.__cause__ = None # in Python 3.x we can use "raise exc from None"
raise exc

def errored(self):
spawn = self.spawn
Expand Down

0 comments on commit 692681f

Please sign in to comment.