Subprocesso de saída em tempo real

import subprocess
import sys

process = subprocess.Popen(cmdCommand, shell = True,bufsize = 1,
                           stdout=subprocess.PIPE, stderr = subprocess.STDOUT,encoding='utf-8', errors = 'replace' ) 
while True:
    realtime_output = process.stdout.readline()
    if realtime_output == '' and process.poll() is not None:
        break
    if realtime_output:
        print(realtime_output.strip(), flush=False)
        sys.stdout.flush()
HotFlow