We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b1e3149 commit 14c92c8Copy full SHA for 14c92c8
1 file changed
tests/utils.py
@@ -40,17 +40,21 @@ def _ping(port: int) -> bool:
40
def kill_process(process: Process):
41
pid = process.pid
42
process.terminate()
43
- process.kill()
44
- _wait_for_process_to_die(process)
+ # allow the process a moment to exit cleanly
+ process.join(timeout=5)
45
+ if process.is_alive():
46
+ process.kill()
47
+ _wait_for_process_to_die(process, timeout=5)
48
process.join()
49
if pid and pid in process_map:
50
del process_map[pid]
51
52
-def _wait_for_process_to_die(process, timeout: int = 5):
53
+def _wait_for_process_to_die(process, timeout: float = 5.0):
54
start = time.time()
55
while time.time() - start < timeout:
56
if not process.is_alive():
57
+ process.join()
58
return
59
time.sleep(0.1)
60
0 commit comments