From 162bdc9a3bf07c21f9d7db83d5e9e9470ec21015 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Tue, 1 May 2018 14:58:18 +0200 Subject: [PATCH] Fix bug in handling of chained tasks Signed-off-by: Clifford Wolf --- sbysrc/sby_core.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sbysrc/sby_core.py b/sbysrc/sby_core.py index cf794d9..6d5cd63 100644 --- a/sbysrc/sby_core.py +++ b/sbysrc/sby_core.py @@ -44,7 +44,7 @@ class SbyTask: self.output_callback = None self.exit_callback = None - self.job.tasks_all.append(self) + self.job.tasks_pending.append(self) def register_dep(self, next_task): if self.finished: @@ -93,6 +93,7 @@ class SbyTask: stderr=(subprocess.STDOUT if self.logstderr else None)) fl = fcntl.fcntl(self.p.stdout, fcntl.F_GETFL) fcntl.fcntl(self.p.stdout, fcntl.F_SETFL, fl | os.O_NONBLOCK) + self.job.tasks_pending.remove(self) self.job.tasks_running.append(self) self.running = True return @@ -155,7 +156,7 @@ class SbyJob: } self.tasks_running = [] - self.tasks_all = [] + self.tasks_pending = [] self.start_clock_time = time() @@ -175,10 +176,10 @@ class SbyJob: print(line, file=f) def taskloop(self): - for task in self.tasks_all: + for task in self.tasks_pending: task.poll() - while len(self.tasks_running): + while len(self.tasks_running) or len(self.tasks_pending): fds = [] for task in self.tasks_running: if task.running: @@ -192,6 +193,9 @@ class SbyJob: for task in self.tasks_running: task.poll() + for task in self.tasks_pending: + task.poll() + if self.opt_timeout is not None: total_clock_time = int(time() - self.start_clock_time) if total_clock_time > self.opt_timeout: -- 2.30.2