Skip to content

Commit dfc38d2

Browse files
committed
Merge pull request #94873 from kroketio/blender-exitcode
blender/import: correct exit code on Python exception
2 parents dc6671a + c5b674a commit dfc38d2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

modules/gltf/editor/editor_import_blend_runner.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,14 +159,18 @@ Error EditorImportBlendRunner::start_blender(const String &p_python_script, bool
159159

160160
List<String> args;
161161
args.push_back("--background");
162+
args.push_back("--python-exit-code");
163+
args.push_back("1");
162164
args.push_back("--python-expr");
163165
args.push_back(p_python_script);
164166

165167
Error err;
168+
String str;
166169
if (p_blocking) {
167170
int exitcode = 0;
168-
err = OS::get_singleton()->execute(blender_path, args, nullptr, &exitcode);
171+
err = OS::get_singleton()->execute(blender_path, args, &str, &exitcode, true);
169172
if (exitcode != 0) {
173+
print_error(vformat("Blender import failed: %s.", str));
170174
return FAILED;
171175
}
172176
} else {

0 commit comments

Comments
 (0)