fix reading from process

This commit is contained in:
Jakob Ketterl 2021-09-08 13:47:46 +02:00
parent c8ebbb505a
commit d9db74e565

View File

@ -5,6 +5,7 @@ from abc import ABCMeta, abstractmethod
from threading import Thread from threading import Thread
from io import BytesIO from io import BytesIO
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
from functools import partial
import pickle import pickle
@ -104,7 +105,7 @@ class PopenModule(AutoStartModule, metaclass=ABCMeta):
def start(self): def start(self):
self.process = Popen(self.getCommand(), stdin=PIPE, stdout=PIPE) self.process = Popen(self.getCommand(), stdin=PIPE, stdout=PIPE)
Thread(target=self.pump(self.reader.read, self.process.stdin.write)).start() Thread(target=self.pump(self.reader.read, self.process.stdin.write)).start()
Thread(target=self.pump(self.process.stdout.read, self.writer.write)).start() Thread(target=self.pump(partial(self.process.stdout.read, 1024), self.writer.write)).start()
def stop(self): def stop(self):
if self.process is not None: if self.process is not None: