Question : subprocess print logs
Answered by : systemsplit
from subprocess import Popen, PIPE, STDOUT
command = "shell command with arguments"
process = Popen(command, shell=True, stdout=PIPE, stderr=STDOUT)
with process.stdout: for line in iter(process.stdout.readline, b''): print(line.decode("utf-8").strip())
Source : | Last Update : Mon, 29 Nov 21