Вот такой код наклепал я, если нужен именно subprocess.run(), может кому пригодится
import subprocess as sub
import threading as th
import time
def startrar():
with open("test.log", "wb+") as file:
rar = sub.run('"C:\\Program Files\\WinRAR\\Rar.exe" a -r -ep1 -v1g "D:\\mysqlrar" "D:\\Аудиокниги\\book"',
shell=True, stdout=file, stderr=sub.PIPE)
def printpipe():
while True:
with open("test.log", "rb") as file:
print(file.read().decode('cp1251'))
time.sleep(1)
threads = []
threads.append(th.Thread(target=startrar))
threads.append(th.Thread(target=printpipe))
for i in threads:
i.start()