]> source.dussan.org Git - rspamd.git/commitdiff
[Test] Rework kill process tree utility
authorVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 31 Dec 2022 21:35:56 +0000 (21:35 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Sat, 31 Dec 2022 21:35:56 +0000 (21:35 +0000)
test/functional/lib/rspamd.py

index 2bb5ce3d26fc76512bb91131774f40f929ad48b3..49c21a449b8af02ad27bdc9e50396007d5f636e3 100644 (file)
@@ -240,13 +240,14 @@ def shutdown_process_with_children(pid):
         process = psutil.Process(pid=pid)
     except psutil.NoSuchProcess:
         return
-    children = process.children(recursive=False)
+    children = process.children(recursive=True)
     shutdown_process(process)
     for child in children:
         try:
-            shutdown_process(child)
-        except:
+            child.kill()
+        except psutil.NoSuchProcess:
             pass
+    psutil.wait_procs(children, timeout=KILL_WAIT)
 
 def write_to_stdin(process_handle, text):
     if not isinstance(text, bytes):