Spawn.vala
[gitlive] / Spawn.vala
index ef2a8ed..73360a9 100644 (file)
@@ -400,11 +400,13 @@ public class Spawn : Object
         
         //print(JSON.stringify(ch, null,4));
         while (true) {
-            var buffer = new StringBuffer("");
-            
+            string buffer;
+            size_t term_pos;
+            size_t len;
+            IOStatus status;
             try {
-                var status = ch.read_line( buffer,  term_pos );
-            | catch (Error e) {
+                status = ch.read_line( out buffer,  out len,  out term_pos );
+            } catch (Error e) {
                 //FIXme
                 break; // ??
                 
@@ -415,8 +417,13 @@ public class Spawn : Object
                 case GLib.IOStatus.NORMAL:
                
                     //write(fn, x.str);
-                    if (this.listeners[prop]) {
-                        this.listeners[prop].call(this, x.str_return);
+                    //if (this.listeners[prop]) {
+                    //    this.listeners[prop].call(this, x.str_return);
+                    //}
+                    if (ch == this.out_ch) {
+                        this.output += buffer;
+                    } else {
+                        this.stderr += buffer;
                     }
                     _this[prop] += x.str_return;
                     if (_this.debug) {