I want to write a python script that displays its current progress in the last line of the terminal, similar to how apt
(not apt-get
) behaves. I know there are ANSI control sequences to interact with the terminal, but the issue is that I want to call other programs (using subprocess
) which produce their own output. I don't want these programs to overwrite my progress.
There might be multiple subprocesses running at the same time. I'm using the multithreading
module and each thread does some work, then calls and waits for a subprocess, then does cleanup work. I don't mind the output of the subprocesses being mixed, as long as the last line is spared.
When the program exits, the last line should be cleared.