Blender Git Loki

Git Commits -> Revision e11bb77

Revision e11bb77 by Sybren A. Stüvel (master)
January 8, 2019, 11:00 (GMT)
Properly clean up Python when exiting due to --python-exit-code

When BPY_python_end() is not called, there can be buffered data still in
`sys.stdout` or `sys.stderr`. This generally isn't an issue when those are
connected to a terminal, but when they are read by another process (in the case
of rendering with Flamenco, for example) we could miss the actual error message
that's causing the exit in the first place.

The following script demonstrates the issue; before this commit neither the
writes to STDERR and STDOUT nor the traceback of the NameError were shown.

#!/bin/bash

cat > file-with-errors.py <<EOT
import sys
print('THIS IS STDERR', file=sys.stderr)
print('THIS IS STDOUT', file=sys.stdout)
nonexisting.monkey = 3
EOT

blender --enable-autoexec -noaudio --background
any-existing-blendfile.blend
--python-exit-code 42
--python file-with-errors.py 2>&1 | cat

Reviewers: campbellbarton, mont29

Reviewed By: campbellbarton, mont29

Subscribers: fsiddi

Differential Revision: https://developer.blender.org/D4168

Commit Details:

Full Hash: e11bb77f31827f875b536c4dfed18343bcf8f458
Parent Commit: 68b4c57
Lines Changed: +3, -0

1 Modified Path:

/source/creator/creator_args.c (+3, -0) (Diff)
Tehnyt: Miika HämäläinenViimeksi päivitetty: 07.11.2014 14:18MiikaH:n Sivut a.k.a. MiikaHweb | 2003-2021