Why doesn't console.status(...) render correctly with tons of text from a subprocess #2886
-
with rich_console.status("Building Python inside Docker container"):
subprocess.check_call(
[
"docker",
"run",
"--rm",
"-u",
f"{os.getuid()}:{os.getgid()}",
"-v",
f"{tmpdir}:/workdir",
"--entrypoint",
"bash",
f"python-build:{environment}",
"-c",
BUILD_SCRIPT.format(python_version=python_version),
]
) Basically I'm building Python inside a Docker container in a subprocess. I would expect the status text and spinner to always be at the bottom of the screen. Am I using it wrong? Or does it just not work in scenarios where tons of text is written to the terminal really fast? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
The child process is writing directly to stdout, which means that the main process is unable to intercept the output. If you want a subprocess to work with Rich status, you will need to capture and print the output from the child process. |
Beta Was this translation helpful? Give feedback.
The child process is writing directly to stdout, which means that the main process is unable to intercept the output.
If you want a subprocess to work with Rich status, you will need to capture and print the output from the child process.