Python get realtime log output of subprocess in python
def run_command(command):
process = subprocess.Popen((command), stdout=subprocess.PIPE)
while True:
output = process.stdout.readline()
if output == '' and process.poll() is not None:
break if output:
print (output.strip())
rc = process.poll()
return rc
if the process is not breaking after completion of task then add this
output = output.decode("utf-8")
run_command(command)
Download python file
https://drive.google.com/file/d/16KI7j9ARdGaI9NChNX1w0janQCGedqtc/view?usp=sharing
Comments
Post a Comment