summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2012-03-19 22:45:15 +0100
committerhut <hut@lavabit.com>2012-03-19 22:45:15 +0100
commitea8c70ca98149a5d98043b84659d7bca77f984ca (patch)
tree6ef79c6ef46d024a183fa6f728fa0d8096d323f9
parent6c8b05d7c8dd391cb5f6b53868c8502c9f3debd9 (diff)
downloadranger-ea8c70ca98149a5d98043b84659d7bca77f984ca.tar.gz
ext.rifle: use setsid instead of nohup (keep nohup as fallback)
this could perhaps be done by os.setsid and os.fork etc
-rw-r--r--ranger/defaults/rifle.conf2
-rwxr-xr-xranger/ext/rifle.py5
2 files changed, 5 insertions, 2 deletions
diff --git a/ranger/defaults/rifle.conf b/ranger/defaults/rifle.conf
index 2e86d463..2f99adba 100644
--- a/ranger/defaults/rifle.conf
+++ b/ranger/defaults/rifle.conf
@@ -30,7 +30,7 @@
 #
 # Flags are single characters which slightly transform the command:
 #   f | Fork the program, make it run in the background.
-#     |   New command = nohup $command >& /dev/null &
+#     |   New command = setsid $command >& /dev/null &
 #   r | Execute the command with root permissions
 #     |   New command = sudo $command
 #   t | Run the program in a new terminal.  If $TERMCMD is not defined,
diff --git a/ranger/ext/rifle.py b/ranger/ext/rifle.py
index 80dd0ba7..b98c35d3 100755
--- a/ranger/ext/rifle.py
+++ b/ranger/ext/rifle.py
@@ -189,7 +189,10 @@ class Rifle(object):
 				os.environ['TERMCMD'] = term
 			action = "$TERMCMD -e %s" % action
 		if 'f' in flags:
-			action = "nohup %s >& /dev/null &" % action
+			if 'setsid' in get_executables():
+				action = "setsid %s >& /dev/null &" % action
+			else:
+				action = "nohup %s >& /dev/null &" % action
 		return action
 
 	def list_commands(self, files, mimetype=None):