I have a rather long job that lasts several minutes and then restarts. The task displays various information, which I write as follows:
output = subprocess.Popen(cmd,stdout=subprocess.PIPE).communicate()
The fact is that I get only all the output at a time. I would like to show the output as the program sends it to stdout, but still pushes it back to the buffer (I need to check the output for some lines). In Ruby, I would do it like this:
IO.popen(cmd) do |io| io.each_line do |line| puts line buffer << line end end
python
Geo Nov 02 2018-11-11T00: 00Z
source share