From 584fa6be243ff93d4a288b42ab2bfea7640542c0 Mon Sep 17 00:00:00 2001 From: hut Date: Wed, 27 Apr 2011 00:05:42 +0200 Subject: core.loader: Fix blocking when using interactive scripts in scope.sh --- ranger/core/loader.py | 4 +++- ranger/data/scope.sh | 4 ++-- 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 -- cgit 1.4.1-2-gfad0