summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2012-08-15 01:48:19 +0200
committerhut <hut@lavabit.com>2012-08-15 01:48:19 +0200
commit491497d82b2c6620f735e9080413112f0e37572a (patch)
tree852f609ab80cb64ab2e52f1ff0aac6ba47f73589 /ranger
parent413c887bf405265d062516070d6ba3800b1293c0 (diff)
downloadranger-491497d82b2c6620f735e9080413112f0e37572a.tar.gz
core.runner: remove 'setsid' dependency, use Popen_forked
Diffstat (limited to 'ranger')
-rw-r--r--ranger/core/runner.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/ranger/core/runner.py b/ranger/core/runner.py
index 96f557b3..f00de6c1 100644
--- a/ranger/core/runner.py
+++ b/ranger/core/runner.py
@@ -158,15 +158,13 @@ class Runner(object):
 			toggle_ui = False
 			pipe_output = True
 			context.wait = False
-		if 's' in context.flags or 'f' in context.flags:
+		if 's' in context.flags:
 			devnull_writable = open(os.devnull, 'w')
 			devnull_readable = open(os.devnull, 'r')
 			for key in ('stdout', 'stderr'):
 				popen_kws[key] = devnull_writable
 			popen_kws['stdin'] = devnull_readable
 		if 'f' in context.flags:
-			if not isinstance(action, str) and 'setsid' in get_executables():
-				action = ['setsid'] + action
 			toggle_ui = False
 			context.wait = False
 		if 'w' in context.flags:
@@ -208,14 +206,19 @@ class Runner(object):
 			self.fm.signal_emit('runner.execute.before',
 					popen_kws=popen_kws, context=context)
 			try:
-				process = Popen(**popen_kws)
+				if 'f' in context.flags:
+					# This can fail and return False if os.fork() is not
+					# supported, but we assume it is, since curses is used.
+					Popen_forked(**popen_kws)
+				else:
+					process = Popen(**popen_kws)
 			except Exception as e:
 				error = e
 				self._log("Failed to run: %s\n%s" % (str(action), str(e)))
 			else:
 				if context.wait:
 					process.wait()
-				else:
+				elif process:
 					self.zombies.add(process)
 				if wait_for_enter:
 					press_enter()