From d82b6ca75007541341b8694d17d850c1fb21a8da Mon Sep 17 00:00:00 2001 From: Joona Hoikkala Date: Wed, 11 Mar 2020 19:27:46 +0200 Subject: [PATCH] Fix issue of breaking process when a child process of subprocess closes stdout pipe --- Interlace/lib/threader.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Interlace/lib/threader.py b/Interlace/lib/threader.py index 014c7f3..e367f06 100644 --- a/Interlace/lib/threader.py +++ b/Interlace/lib/threader.py @@ -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: