[gedit-plugins] [commander/shell] Fix buffering of output



commit 16f14f95efad3e80268a3678826ddecbb2c266cf
Author: Jesse van den Kieboom <jessevdk gmail com>
Date:   Fri Sep 5 11:21:27 2014 +0200

    [commander/shell] Fix buffering of output

 plugins/commander/modules/shell.py |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/plugins/commander/modules/shell.py b/plugins/commander/modules/shell.py
index 7060b70..0bcc988 100644
--- a/plugins/commander/modules/shell.py
+++ b/plugins/commander/modules/shell.py
@@ -68,15 +68,17 @@ class Process:
                 ret = fd.read()
 
                 # This seems to happen on OS X...
-                if ret == '':
-                    condition = condition | GLib.IOConditiom.HUP
+                if len(ret) == 0:
+                    condition = condition | GLib.IOCondition.HUP
                 else:
-                    self._buffer += ret
+                    self._buffer += ret.decode('utf-8')
 
                     if not self.replace:
                         self.update()
-            except:
-                self.entry.info_show(self._buffer.strip("\n"))
+            except Exception as e:
+                if len(self._buffer) > 0:
+                    self.entry.info_show(self._buffer.strip("\n"))
+
                 self.stop()
                 return False
 
@@ -92,7 +94,7 @@ class Process:
 
                 buf.insert_at_cursor(self._buffer)
                 buf.end_user_action()
-            else:
+            elif len(self._buffer) > 0:
                 self.entry.info_show(self._buffer.strip("\n"))
 
             self.stop()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]