diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2018-09-05 00:15:55 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2018-09-06 19:19:32 +0300 |
commit | 7e754518677003a6b5760cfb57775f5f9dde597a (patch) | |
tree | aa71aed0e7723d1405bccda7fc08e22af4ad9a5b /mesonbuild/mtest.py | |
parent | f2bde320ad433e925ef55fd8dccf6d66cf5651a3 (diff) | |
download | meson-7e754518677003a6b5760cfb57775f5f9dde597a.zip meson-7e754518677003a6b5760cfb57775f5f9dde597a.tar.gz meson-7e754518677003a6b5760cfb57775f5f9dde597a.tar.bz2 |
Try to kill processes even more thoroughly. Closes #4127.
Diffstat (limited to 'mesonbuild/mtest.py')
-rw-r--r-- | mesonbuild/mtest.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py index 3d3d2f5..910136f 100644 --- a/mesonbuild/mtest.py +++ b/mesonbuild/mtest.py @@ -354,7 +354,18 @@ class SingleTestRunner: # There's nothing we can do (maybe the process # already died) so carry on. pass - (stdo, stde) = p.communicate() + try: + (stdo, stde) = p.communicate(timeout=1) + except subprocess.TimeoutExpired: + # An earlier kill attempt has not worked for whatever reason. + # Try to kill it one last time with a direct call. + # If the process has spawned children, they will remain around. + p.kill() + try: + (stdo, stde) = p.communicate(timeout=1) + except subprocess.TimeoutExpired: + stdo = b'Test process could not be killed.' + stde = b'' endtime = time.time() duration = endtime - starttime stdo = decode(stdo) |