buildroot: set PYTHONUNBUFFERED env variable
This disables buffering for the standard output stream for python
executables spawn within the build root. This should help with
the ordering of text output in stages: when stdout is buffered,
debug messages via `print` will be end up in that buffer. When
executables are run in the stage, via `subprocess.run` their
stdout has its own buffering, which will be flushed at the end
of the run. If stdout was not manually flushed before invoking
the executable, the output of the tool will be emitted before
anything in the buffer. For example:
print("stage")
subprocess.run(["echo", "tool"])
Will lead have the following ordering:
"tool"
"stage"
To avoid this, without having to manually flush the stdout
buffer before every `subprocess.run`, disable buffering for
python binaries run inside the build root.
This commit is contained in:
parent
7f50d2b57f
commit
acfc5f6d71
1 changed files with 1 additions and 0 deletions
|
|
@ -221,6 +221,7 @@ class BuildRoot(contextlib.AbstractContextManager):
|
|||
"--new-session",
|
||||
"--setenv", "PATH", "/usr/sbin:/usr/bin",
|
||||
"--setenv", "PYTHONPATH", "/run/osbuild/lib",
|
||||
"--setenv", "PYTHONUNBUFFERED", "1",
|
||||
"--unshare-ipc",
|
||||
"--unshare-pid",
|
||||
"--unshare-net"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue