Merge pull request #96 from joohoi/fix_95

Fix issue of breaking process when a child process of subprocess closes stdout pipe
This commit is contained in:
Michael Skelton
2020-03-12 07:27:32 +10:00
committed by GitHub

View File

@@ -48,8 +48,10 @@ class Task(object):
def _run_task(self, t=False):
if t:
s = subprocess.Popen(self.task, shell=True, stdout=subprocess.PIPE)
out = s.stdout.readline().decode("utf-8")
s = subprocess.Popen(self.task, shell=True,
stdout=subprocess.PIPE,
encoding="utf-8")
out, _ = s.communicate()
if out != "":
t.write(out)
else: