summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/core/runner.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/ranger/core/runner.py b/ranger/core/runner.py
index 7d433652..baec1595 100644
--- a/ranger/core/runner.py
+++ b/ranger/core/runner.py
@@ -194,10 +194,11 @@ class Runner(object):
 		if 'r' in context.flags:
 			if 'sudo' not in get_executables():
 				return self._log("Can not run with 'r' flag, sudo is not installed!")
+			dflag = ('d' in context.flags)
 			if isinstance(action, str):
-				action = 'sudo '+action
+				action = 'sudo ' + (dflag and '-b ' or '') + action
 			else:
-				action = ['sudo']+action
+				action = ['sudo'] + (dflag and ['-b'] or []) + action
 			toggle_ui = True
 			context.wait = True
 		if 't' in context.flags: