From ab8c48472e99b8d0330f9d6084f192564b110afb Mon Sep 17 00:00:00 2001 From: hut Date: Tue, 18 Oct 2011 16:26:58 +0200 Subject: core.fm: Fixed zombie invasions --- ranger/core/fm.py | 6 ++++++ ranger/core/runner.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/ranger/core/fm.py b/ranger/core/fm.py index 93ac793b..59eb4e18 100644 --- a/ranger/core/fm.py +++ b/ranger/core/fm.py @@ -174,6 +174,7 @@ class FM(Actions, SignalDispatcher): loader = self.loader env = self.env has_throbber = hasattr(ui, 'throbber') + zombies = self.run.zombies try: while True: @@ -190,6 +191,11 @@ class FM(Actions, SignalDispatcher): ui.handle_input() + if zombies: + for zombie in tuple(zombies): + if zombie.poll() is not None: + zombies.remove(zombie) + gc_tick += 1 if gc_tick > TICKS_BEFORE_COLLECTING_GARBAGE: gc_tick = 0 diff --git a/ranger/core/runner.py b/ranger/core/runner.py index 2773d2bd..940f410e 100644 --- a/ranger/core/runner.py +++ b/ranger/core/runner.py @@ -98,6 +98,7 @@ class Runner(object): self.ui = ui self.logfunc = logfunc self.apps = apps + self.zombies = set() def _log(self, text): try: @@ -201,6 +202,8 @@ class Runner(object): else: if context.wait: process.wait() + else: + self.zombies.add(process) if wait_for_enter: press_enter() finally: -- cgit 1.4.1-2-gfad0