summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/core/loader.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/ranger/core/loader.py b/ranger/core/loader.py
index 02e8c232..5e509e0b 100644
--- a/ranger/core/loader.py
+++ b/ranger/core/loader.py
@@ -21,6 +21,7 @@ from ranger.core.shared import FileManagerAware
 from ranger.ext.signal_dispatcher import SignalDispatcher
 import math
 import os
+import sys
 import select
 
 
@@ -73,6 +74,7 @@ class CommandLoader(Loadable, SignalDispatcher, FileManagerAware):
 				yield
 				sleep(0.03)
 		else:
+			py3 = sys.version > '3'
 			selectlist = []
 			if self.read:
 				selectlist.append(process.stdout)
@@ -86,19 +88,28 @@ class CommandLoader(Loadable, SignalDispatcher, FileManagerAware):
 						rd = rd[0]
 						if rd == process.stderr:
 							read = rd.readline()
+							if py3:
+								read = read.decode('utf-8')
 							if read:
 								self.fm.notify(read, bad=True)
 						elif rd == process.stdout:
 							read = rd.read(512)
+							if py3:
+								read = read.decode('utf-8')
 							if read:
 								self.stdout_buffer += read
 				except select.error:
 					sleep(0.03)
 			if not self.silent:
 				for l in process.stderr.readlines():
+					if py3:
+						l = l.decode('utf-8')
 					self.fm.notify(l, bad=True)
 			if self.read:
-				self.stdout_buffer += process.stdout.read()
+				read = process.stdout.read()
+				if py3:
+					read = read.decode('utf-8')
+				self.stdout_buffer += read
 		self.finished = True
 		self.signal_emit('after', process=process, loader=self)
 
'>23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205