diff --git a/buildroot/share/PlatformIO/scripts/preprocessor.py b/buildroot/share/PlatformIO/scripts/preprocessor.py index efc3a6261e..3cd279fa57 100644 --- a/buildroot/share/PlatformIO/scripts/preprocessor.py +++ b/buildroot/share/PlatformIO/scripts/preprocessor.py @@ -37,15 +37,20 @@ def run_preprocessor(env, fn=None): else: cmd += ['-D' + s] - cmd += ['-D__MARLIN_DEPS__ -w -dM -E -x c++'] - depcmd = cmd + [ filename ] - cmd = ' '.join(depcmd) + cmd += ['-D__MARLIN_DEPS__ -w -dM -E -x c++', filename] + + cmd = ' '.join(cmd) blab(cmd) + try: - define_list = subprocess.check_output(cmd, shell=True).splitlines() + define_list_text = subprocess.check_output(cmd, shell=True) except: - define_list = {} + raise RuntimeError(f"Command `{cmd}` failed during build pre-processing.") + + define_list = define_list_text.splitlines() if define_list_text else [] + preprocessor_cache[filename] = define_list + return define_list