[gedit] tools: make pipe None if the channel executions have finished



commit d517f09005099f072e4058360913242f5d84dcb8
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Wed Apr 3 13:07:00 2013 +0200

    tools: make pipe None if the channel executions have finished

 plugins/externaltools/tools/capture.py |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/plugins/externaltools/tools/capture.py b/plugins/externaltools/tools/capture.py
index 8a36e7b..a8f2d41 100644
--- a/plugins/externaltools/tools/capture.py
+++ b/plugins/externaltools/tools/capture.py
@@ -141,11 +141,11 @@ class Capture(GObject.Object):
             m = min(l, self.WRITE_BUFFER_SIZE)
 
             self.pipe.stdin.write(self.write_buffer[:m])
-            
+
             if m == l:
                 self.write_buffer = b''
                 self.pipe.stdin.close()
-                
+
                 self.idle_write_id = 0
 
                 return False
@@ -184,6 +184,9 @@ class Capture(GObject.Object):
             self.out_channel.shutdown(True)
             self.out_channel = None
             self.out_channel_id = 0
+            # pipe should be set to None only if the err has finished too
+            if self.err_channel is None:
+                self.pipe = None
 
         return ret
 
@@ -193,6 +196,9 @@ class Capture(GObject.Object):
             self.err_channel.shutdown(True)
             self.err_channel = None
             self.err_channel = 0
+            # pipe should be set to None only if the out has finished too
+            if self.out_channel is None:
+                self.pipe = None
 
         return ret
 


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