diff options
-rw-r--r-- | pym/_emerge/Scheduler.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index aaa05d1f4..9f7285634 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -295,6 +295,13 @@ class Scheduler(PollScheduler): def _terminate_tasks(self): self._status_display.quiet = True + # Remove running_tasks that have been added to queues but + # haven't been started yet, since we're going to discard + # them and their start/exit handlers won't be called. + for build in self._task_queues.jobs._task_queue: + self._running_tasks.remove(build.pkg) + for merge in self._task_queues.merge._task_queue: + self._running_tasks.remove(merge.merge.pkg) for q in self._task_queues.values(): q.clear() @@ -1471,7 +1478,13 @@ class Scheduler(PollScheduler): mtimedb.commit() def _build_exit(self, build): - if build.returncode == os.EX_OK: + if build.returncode == os.EX_OK and self._terminated.is_set(): + # We've been interrupted, so we won't + # add this to the merge queue. + self.curval += 1 + self._running_tasks.remove(build.pkg) + self._deallocate_config(build.settings) + elif build.returncode == os.EX_OK: self.curval += 1 merge = PackageMerge(merge=build) if not build.build_opts.buildpkgonly and \ |