diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-09-23 11:50:25 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-09-23 22:13:08 +0100 |
commit | 8f1c2f851a87c3402766a8408a8ee65d6a4fb785 (patch) | |
tree | 93958ef07af1ea201e20c936c152cd556df56c52 /bitbake | |
parent | 10e73107307ab5ece9d0430af17f3d9f28f457ad (diff) | |
download | poky-8f1c2f851a87c3402766a8408a8ee65d6a4fb785.tar.gz |
bitbake: build: Ensure python stdout/stderr is logged correctly
Currently we see things like:
Log data follows:
| DEBUG: Executing python function do_pythontest_exit
| DEBUG: Python function do_pythontest_exit finished
| ERROR: 1
| This is python stdout
Whilst after the change we see things like:
Log data follows:
| DEBUG: Executing python function do_pythontest_exit
| This is python stdout
| DEBUG: Python function do_pythontest_exit finished
| ERROR: 1
since the output is now correctly mixed with the log messages. In some cases the logging
tests indicate the output is being lost entirely which is bad for debugging and makes
things rather confusing.
(Bitbake rev: 8966b43761500e0505333d8c9a3f0f2c3dbe7559)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/build.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py index c2479dd167..18586c276e 100644 --- a/bitbake/lib/bb/build.py +++ b/bitbake/lib/bb/build.py | |||
@@ -298,6 +298,10 @@ def exec_func_python(func, d, runfile, cwd=None): | |||
298 | comp = utils.better_compile(code, func, "exec_func_python() autogenerated") | 298 | comp = utils.better_compile(code, func, "exec_func_python() autogenerated") |
299 | utils.better_exec(comp, {"d": d}, code, "exec_func_python() autogenerated") | 299 | utils.better_exec(comp, {"d": d}, code, "exec_func_python() autogenerated") |
300 | finally: | 300 | finally: |
301 | # We want any stdout/stderr to be printed before any other log messages to make debugging | ||
302 | # more accurate. In some cases we seem to lose stdout/stderr entirely in logging tests without this. | ||
303 | sys.stdout.flush() | ||
304 | sys.stderr.flush() | ||
301 | bb.debug(2, "Python function %s finished" % func) | 305 | bb.debug(2, "Python function %s finished" % func) |
302 | 306 | ||
303 | if cwd and olddir: | 307 | if cwd and olddir: |