From 6a3e29ccd47ac7c20de1c28de8b6323fa7c77ae2 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Wed, 3 Feb 2016 13:27:39 +1100 Subject: [PATCH] If test exes can not be removed (because e.g. an antivirus program holds on to the file), just leave them behind. Closes #378. --- mesonbuild/compilers.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index ec0181efa..078e87c0b 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -437,7 +437,13 @@ int someSymbolHereJustForFun; se = se.decode() mlog.debug('Program stdout:\n', so) mlog.debug('Program stderr:\n', se) - os.remove(exename) + try: + os.remove(exename) + except PermissionError: + # On Windows antivirus programs and the like hold + # on to files so they can't be deleted. There's not + # much to do in this case. + pass return RunResult(True, pe.returncode, so, se) def cross_sizeof(self, element, prefix, env, extra_args=[]):