I am trying to write a wrapper script for a command line program (svnadmin verify) that will display a nice progress indicator for the operation. This requires me to be abl
Depending on the use case, you might also want to disable the buffering in the subprocess itself.
If the subprocess will be a Python process, you could do this before the call:
os.environ["PYTHONUNBUFFERED"] = "1"
Or alternatively pass this in the env
argument to Popen
.
Otherwise, if you are on Linux/Unix, you can use the stdbuf
tool. E.g. like:
cmd = ["stdbuf", "-oL"] + cmd
See also here about stdbuf
or other options.
(See also here for the same answer.)