summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/core/loader.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/ranger/core/loader.py b/ranger/core/loader.py
index bae19e9e..d5e5e615 100644
--- a/ranger/core/loader.py
+++ b/ranger/core/loader.py
@@ -133,6 +133,7 @@ class CommandLoader(Loadable, SignalDispatcher, FileManagerAware):
         self.kill_on_pause = kill_on_pause
 
     def generate(self):
+        py3 = sys.version >= '3'
         if self.input:
             stdin = PIPE
         else:
@@ -141,12 +142,17 @@ class CommandLoader(Loadable, SignalDispatcher, FileManagerAware):
                 stdout=PIPE, stderr=PIPE, stdin=stdin)
         self.signal_emit('before', process=process, loader=self)
         if self.input:
+            if py3:
+                import io
+                stdin = io.TextIOWrapper(process.stdin)
+            else:
+                stdin = process.stdin
             try:
-                process.stdin.write(self.input)
+                stdin.write(self.input)
             except IOError as e:
                 if e.errno != errno.EPIPE and e.errno != errno.EINVAL:
                     raise
-            process.stdin.close()
+            stdin.close()
         if self.silent and not self.read:
             while process.poll() is None:
                 yield
@@ -154,7 +160,6 @@ class CommandLoader(Loadable, SignalDispatcher, FileManagerAware):
                     break
                 sleep(0.03)
         else:
-            py3 = sys.version >= '3'
             selectlist = []
             if self.read:
                 selectlist.append(process.stdout)
mpwn.com> 2019-04-29 09:29:41 -0400 Update go-imap to 1.0.0-beta.4' href='/akspecs/aerc/commit/go.mod?h=0.5.0&id=072bc268723957f235edcff7b45fd41b04ccab27'>072bc26 ^
28021ed ^
8d20e92 ^
d394fd1 ^
28021ed ^
072bc26 ^
28021ed ^

b0bf09b ^
513e8aa ^
16c3f0a ^
072bc26 ^
8d20e92 ^
072bc26 ^
072bc26 ^
3836d24 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27