From c9a0ec3e289a9a189cfd35b0a1680f7d6bc12525 Mon Sep 17 00:00:00 2001 From: Daniel Malea Date: Fri, 22 Feb 2013 00:41:26 +0000 Subject: [PATCH] Make the lldbtest tear down routine a little less error prone - replace "catch-all" except clause with one that specifically catches what pexpect throws - handle case where child is already terminated (or is terminating) by the time tear-down is run llvm-svn: 175844 --- lldb/test/lldbtest.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py index a1a3864..d45e6d4 100644 --- a/lldb/test/lldbtest.py +++ b/lldb/test/lldbtest.py @@ -777,15 +777,17 @@ class Base(unittest2.TestCase): if self.child and self.child.isalive(): with recording(self, traceAlways) as sbuf: print >> sbuf, "tearing down the child process...." - if self.child_in_script_interpreter: - self.child.sendline('quit()') - self.child.expect_exact(self.child_prompt) - self.child.sendline('settings set interpreter.prompt-on-quit false') - self.child.sendline('quit') try: + if self.child_in_script_interpreter: + self.child.sendline('quit()') + self.child.expect_exact(self.child_prompt) + self.child.sendline('settings set interpreter.prompt-on-quit false') + self.child.sendline('quit') self.child.expect(pexpect.EOF) - except: + except ValueError, ExceptionPexpect: + # child is already terminated pass + # Give it one final blow to make sure the child is terminated. self.child.close() -- 2.7.4