[gedit] Make sure last output line is properly read



commit 1ff23cf0dc70cb4604cd1b853c6153055bb1c027
Author: Jesse van den Kieboom <jvanden grijpc10 epfl ch>
Date:   Fri May 22 09:55:10 2009 +0200

    Make sure last output line is properly read
---
 plugins/externaltools/tools/capture.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/plugins/externaltools/tools/capture.py b/plugins/externaltools/tools/capture.py
index be0fe3f..56930c8 100644
--- a/plugins/externaltools/tools/capture.py
+++ b/plugins/externaltools/tools/capture.py
@@ -111,7 +111,7 @@ class Capture(gobject.GObject):
     def on_output(self, source, condition):
         line = source.readline()
 
-        if self.pipe and len(line) > 0:
+        if len(line) > 0:
             try:
                 line = unicode(line, 'utf-8')
             except:
@@ -119,11 +119,13 @@ class Capture(gobject.GObject):
                                locale.getdefaultlocale()[1],
                                'replace')
 
-            if source == self.pipe.stdout:
+            if not self.pipe or source == self.pipe.stdout:
                 self.emit('stdout-line', line)
             else:
                 self.emit('stderr-line', line)
             return True
+        else:
+            self.pipe = None
 
         return False
 
@@ -139,6 +141,5 @@ class Capture(gobject.GObject):
         # In an idle, so it is emitted after all the std*-line signals
         # have been intercepted
         gobject.idle_add(self.emit, 'end-execute', error_code)
-        self.pipe = None
 
 # ex:ts=4:et:



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