Browse Source
[Test] Rework kill process tree utility
pull/4367/head
Vsevolod Stakhov
3 years ago
No known key found for this signature in database
GPG Key ID: 7647B6790081437
1 changed files with
4 additions and
3 deletions
-
test/functional/lib/rspamd.py
|
|
|
@ -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): |
|
|
|
|