fix reading from process
This commit is contained in:
parent
c8ebbb505a
commit
d9db74e565
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user