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



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@175844 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/lldbtest.py b/test/lldbtest.py
index a1a3864..d45e6d4 100644
--- a/test/lldbtest.py
+++ b/test/lldbtest.py
@@ -777,15 +777,17 @@
         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()