I am looking for a way to generate a progress bar for a process executing on a remote linux machine (through ssh). The process on the remote machine is a g++ compilation of a big C++ project.
A lot of output text is produced by the compilation process. I imagine to generate the progress bar by displaying (in the shell on the local machine) a "#" each time a line starting with "Making install in" comes out from the compilation process on the remote machine (I know how many such lines it will be in total, so I know how long the progress bar will be).
The remote process is started from a python script on the local machine, and I have currently come so far:
cmd="ssh "+rhost+" \"cd "+r_build_dir+" ; make -j install | grep 'Making install in'\""
# perhaps I could also have used: commands.getoutput(cmd) instead of os.system(cmd)
This kind of does what I want, but the whole point is lost because all the lines come out at once when the remote compilation process is done!, e.g.:
Making install in ProjectRoot
Making install in ProjectRoot/Project1
Making install in ProjectRoot/Project2
Making install in ProjectRoot/Project3
Of course the lines should be displayed one by one as the compilation progresses. Ideally I don't even want see those lines coming, but a growing progress bar.
The solution is probably related to flushing stdout and ssh. You experts probably have a "one-liner" to do the job!