summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2011-10-18 16:26:58 +0200
committerhut <hut@lavabit.com>2011-10-18 16:26:58 +0200
commitab8c48472e99b8d0330f9d6084f192564b110afb (patch)
treecbb1f1531e13c85e73644920234b6d586f367e0d
parente0f34391a01fadd867502cbc440d7f35e77fbd6d (diff)
downloadranger-ab8c48472e99b8d0330f9d6084f192564b110afb.tar.gz
core.fm: Fixed zombie invasions
-rw-r--r--ranger/core/fm.py6
-rw-r--r--ranger/core/runner.py3
2 files changed, 9 insertions, 0 deletions
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: