about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/core/loader.py4
-rwxr-xr-xranger/data/scope.sh4
2 files changed, 5 insertions, 3 deletions
diff --git a/ranger/core/loader.py b/ranger/core/loader.py
index 7fd7dbab..d063148b 100644
--- a/ranger/core/loader.py
+++ b/ranger/core/loader.py
@@ -70,8 +70,9 @@ class CommandLoader(Loadable, SignalDispatcher, FileManagerAware):
 		self.stdout_buffer = ""
 
 	def generate(self):
+		null = open(os.devnull, 'r')
 		self.process = process = Popen(self.args,
-				stdout=PIPE, stderr=PIPE)
+				stdout=PIPE, stderr=PIPE, stdin=null)
 		self.signal_emit('before', process=process, loader=self)
 		if self.silent and not self.read:
 			while process.poll() is None:
@@ -114,6 +115,7 @@ class CommandLoader(Loadable, SignalDispatcher, FileManagerAware):
 				if py3:
 					read = safeDecode(read)
 				self.stdout_buffer += read
+		null.close()
 		self.finished = True
 		self.signal_emit('after', process=process, loader=self)
 
diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh
index 6ab9df51..4d778486 100755
--- a/ranger/data/scope.sh
+++ b/ranger/data/scope.sh
@@ -3,8 +3,8 @@
 # Its output is used as the preview.  ANSI color codes are supported.
 
 # NOTES: This script is considered a configuration file.  If you upgrade
-# ranger, it will be left untouched. (You must update it yourself)
-# NEVER make this script interactive. (by starting mplayer or something)
+# ranger, it will be left untouched. (You must update it yourself.)
+# Also, ranger disables STDIN here, so interactive scripts won't work properly
 
 # Meanings of exit codes:
 # code | meaning    | action of ranger