]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
tests: don't crash if lldpd crashed
authorVincent Bernat <vincent@bernat.im>
Mon, 12 Mar 2018 16:21:03 +0000 (17:21 +0100)
committerVincent Bernat <vincent@bernat.im>
Mon, 12 Mar 2018 16:21:03 +0000 (17:21 +0100)
Otherwise, we don't get the appropriate information!

tests/integration/fixtures/programs.py

index 8f91db5825b523fbed1f8729fced0cb346c949e1..63f7e1a268dd8fa49583d0df1574bdef4033eada 100644 (file)
@@ -168,12 +168,18 @@ class LldpdFactory(object):
 
     def killall(self):
         for p in self.pids[:]:
-            os.kill(p, signal.SIGTERM)
+            try:
+                os.kill(p, signal.SIGTERM)
+            except ProcessLookupError:
+                continue
         for t in self.threads:
             if t.is_alive():
                 t.join(1)
         for p in self.pids[:]:
-            os.kill(p, signal.SIGKILL)
+            try:
+                os.kill(p, signal.SIGKILL)
+            except ProcessLookupError:
+                continue
         for t in self.threads:
             if t.is_alive():
                 t.join(1)