Fix issue of breaking process when a child process of subprocess closes stdout pipe

This commit is contained in:
Joona Hoikkala
2020-03-11 19:27:46 +02:00
parent 053336cffe
commit d82b6ca750

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: