about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2018-10-26 18:02:17 +0200
committertoonn <toonn@toonn.io>2018-10-26 18:02:17 +0200
commite9ef0d9517bb3b29596f4a8105908e1c428e06fd (patch)
tree4efeb23fe8f8d46d037e077435ef992279d7c535
parentf85d3fd6f95646355673445e6305a2781067225b (diff)
parentf9c49f9c2e7ec680f9a06685eba75787e7d2ed7b (diff)
downloadranger-e9ef0d9517bb3b29596f4a8105908e1c428e06fd.tar.gz
Merge branch 'baranovskiy-fix_decode'
-rw-r--r--ranger/core/loader.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/ranger/core/loader.py b/ranger/core/loader.py
index 274dc610..9f32535f 100644
--- a/ranger/core/loader.py
+++ b/ranger/core/loader.py
@@ -194,6 +194,7 @@ class CommandLoader(  # pylint: disable=too-many-instance-attributes
                 selectlist.append(process.stdout)
             if not self.silent:
                 selectlist.append(process.stderr)
+            read_stdout = None
             while process.poll() is None:
                 yield
                 if self.finished:
@@ -210,10 +211,11 @@ class CommandLoader(  # pylint: disable=too-many-instance-attributes
                                 self.fm.notify(read, bad=True)
                         elif robjs == process.stdout:
                             read = robjs.read(512)
-                            if py3:
-                                read = safe_decode(read)
                             if read:
-                                self.stdout_buffer += read
+                                if read_stdout is None:
+                                    read_stdout = read
+                                else:
+                                    read_stdout += read
                 except select.error:
                     sleep(0.03)
             if not self.silent:
@@ -223,9 +225,12 @@ class CommandLoader(  # pylint: disable=too-many-instance-attributes
                     self.fm.notify(line, bad=True)
             if self.read:
                 read = process.stdout.read()
+                if read:
+                    read_stdout += read
+            if read_stdout:
                 if py3:
-                    read = safe_decode(read)
-                self.stdout_buffer += read
+                    read_stdout = safe_decode(read_stdout)
+                self.stdout_buffer += read_stdout
         self.finished = True
         self.signal_emit('after', process=process, loader=self)