[Lldb-commits] [lldb] r241589 - Fix _LocalProcess.terminate on Windows.

Adrian McCarthy amccarth at google.com
Tue Jul 7 07:47:34 PDT 2015


Author: amccarth
Date: Tue Jul  7 09:47:34 2015
New Revision: 241589

URL: http://llvm.org/viewvc/llvm-project?rev=241589&view=rev
Log:
Fix _LocalProcess.terminate on Windows.

Modified:
    lldb/trunk/test/lldbtest.py

Modified: lldb/trunk/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbtest.py?rev=241589&r1=241588&r2=241589&view=diff
==============================================================================
--- lldb/trunk/test/lldbtest.py (original)
+++ lldb/trunk/test/lldbtest.py Tue Jul  7 09:47:34 2015
@@ -285,18 +285,15 @@ class _LocalProcess(_BaseProcess):
     def terminate(self):
         if self._proc.poll() == None:
             # Terminate _proc like it does the pexpect
-            self._proc.send_signal(signal.SIGHUP)
-            time.sleep(self._delayafterterminate)
-            if self._proc.poll() != None:
-                return
-            self._proc.send_signal(signal.SIGCONT)
-            time.sleep(self._delayafterterminate)
-            if self._proc.poll() != None:
-                return
-            self._proc.send_signal(signal.SIGINT)
-            time.sleep(self._delayafterterminate)
-            if self._proc.poll() != None:
-                return
+            signals_to_try = [sig for sig in ['SIGHUP', 'SIGCONT', 'SIGINT'] if sig in dir(signal)]
+            for sig in signals_to_try:
+                try:
+                    self._proc.send_signal(getattr(signal, sig))
+                    time.sleep(self._delayafterterminate)
+                    if self._proc.poll() != None:
+                        return
+                except ValueError:
+                    pass  # Windows says SIGINT is not a valid signal to send
             self._proc.terminate()
             time.sleep(self._delayafterterminate)
             if self._proc.poll() != None:





More information about the lldb-commits mailing list