diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index ce8968c07..c299a5c2f 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -199,7 +199,10 @@ int dummy; def generate_compdb(self): ninja_exe = environment.detect_ninja() builddir = self.environment.get_build_dir() - jsondb = subprocess.check_output([ninja_exe, '-t', 'compdb', 'c_COMPILER', 'cpp_COMPILER'], cwd=builddir) + try: + jsondb = subprocess.check_output([ninja_exe, '-t', 'compdb', 'c_COMPILER', 'cpp_COMPILER'], cwd=builddir) + except Exception: + raise MesonException('Could not create compilation database.') open(os.path.join(builddir, 'compile_commands.json'), 'wb').write(jsondb) # Get all generated headers. Any source file might need them so