From c5b674ac9e413356fe124cb62b7cf4df412f7b8f Mon Sep 17 00:00:00 2001 From: Sander Date: Sun, 28 Jul 2024 14:25:36 +0300 Subject: [PATCH] blender/import: correct exit code on Python exception --- modules/gltf/editor/editor_import_blend_runner.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/gltf/editor/editor_import_blend_runner.cpp b/modules/gltf/editor/editor_import_blend_runner.cpp index 22c8adfe888..ad1258cca8c 100644 --- a/modules/gltf/editor/editor_import_blend_runner.cpp +++ b/modules/gltf/editor/editor_import_blend_runner.cpp @@ -163,14 +163,18 @@ Error EditorImportBlendRunner::start_blender(const String &p_python_script, bool List args; args.push_back("--background"); + args.push_back("--python-exit-code"); + args.push_back("1"); args.push_back("--python-expr"); args.push_back(p_python_script); Error err; + String str; if (p_blocking) { int exitcode = 0; - err = OS::get_singleton()->execute(blender_path, args, nullptr, &exitcode); + err = OS::get_singleton()->execute(blender_path, args, &str, &exitcode, true); if (exitcode != 0) { + print_error(vformat("Blender import failed: %s.", str)); return FAILED; } } else {