summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2012-08-09 05:53:05 +0200
committerhut <hut@lavabit.com>2012-08-09 05:53:05 +0200
commit9d46272c353bc0f00a04d1c8b4b1d72085e92eec (patch)
treece4e22518ae2a54b71fa93f68f83440ad2446157
parent9dd669c7339442a38e87d0954efd7da6aaf258a1 (diff)
downloadranger-9d46272c353bc0f00a04d1c8b4b1d72085e92eec.tar.gz
ext.rifle: silenced output of forked programs
-rwxr-xr-xranger/ext/rifle.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/ranger/ext/rifle.py b/ranger/ext/rifle.py
index 12da48f1..feef4cac 100755
--- a/ranger/ext/rifle.py
+++ b/ranger/ext/rifle.py
@@ -341,8 +341,13 @@ class Rifle(object):
 					cmd = [exe] + prefix + [command]
 				else:
 					cmd = prefix + [command]
-				p = Popen(cmd, env=self.hook_environment(os.environ))
-				if not ('f' in flags or 't' in flags):
+				if 'f' in flags or 't' in flags:
+					devnull_r = open(os.devnull, 'r')
+					devnull_w = open(os.devnull, 'w')
+					p = Popen(cmd, env=self.hook_environment(os.environ),
+						stdin=devnull_r, stdout=devnull_w, stderr=devnull_w)
+				else:
+					p = Popen(cmd, env=self.hook_environment(os.environ))
 					p.wait()
 			finally:
 				self.hook_after_executing(command, self._mimetype, self._app_flags)