Spawn.vala
authorAlan Knowles <alan@roojs.com>
Tue, 10 Nov 2015 07:08:17 +0000 (15:08 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 10 Nov 2015 07:08:17 +0000 (15:08 +0800)
Spawn.vala

index e927c4f..b05e6b7 100644 (file)
@@ -412,8 +412,7 @@ public class Spawn : Object
         return str.length;
         
     }
-
-
     
     /**
      * read from pipe and call appropriate listerner and add to output or stderr string.
@@ -433,10 +432,17 @@ public class Spawn : Object
             size_t len;
             IOStatus status;
             try {
+                               var cond = ch.get_buffer_condition();
+                               if ((cond & GLib.IOCondition.ERR) > 0) {
+                                       return false;
+                               }
+                               if ((cond & GLib.IOCondition.IN) < 1) {
+                                       return false;
+                               }
                 status = ch.read_line( out buffer,  out len,  out term_pos );
             } catch (Error e) {
                 //FIXme
-                break; // ??
+               return false;
                 
             }