Skip to content

Commit 08fbfa5

Browse files
committed
Properly terminate supervisor following test run
1 parent aa18be5 commit 08fbfa5

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tools/test_frontend.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
#!/usr/bin/env python
22

3-
import sys
43
import os
4+
from os.path import join as pjoin
55
import pathlib
6-
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
6+
import sys
7+
sys.path.insert(0, pjoin(os.path.dirname(__file__), '..'))
78

9+
import signal
10+
import socket
811
import subprocess
9-
from os.path import join as pjoin
1012
import time
11-
import socket
1213
from baselayer.tools.supervisor_status import supervisor_status
1314
try:
1415
import http.client as http
@@ -73,7 +74,8 @@ def delete_test_yaml():
7374

7475
clear_tables()
7576

76-
web_client = subprocess.Popen(['make', 'testrun'], cwd=base_dir)
77+
web_client = subprocess.Popen(['make', 'testrun'], cwd=base_dir,
78+
preexec_fn=os.setsid)
7779

7880
print('[test_frontend] Waiting for supervisord to launch all server processes...')
7981

@@ -116,5 +118,5 @@ def delete_test_yaml():
116118
raise
117119
finally:
118120
print('[test_frontend] Terminating supervisord...')
119-
web_client.terminate()
121+
os.killpg(os.getpgid(web_client.pid), signal.SIGTERM)
120122
delete_test_yaml()

0 commit comments

Comments
 (0)