Spawn.vala
[gitlive] / Spawn.vala
index c9e392c..b5df8c8 100644 (file)
@@ -241,7 +241,7 @@ public class Spawn : Object
             stdout.printf("PID: %d" ,this.pid);
         }
         
-        this.ref();
+        this.ref(); // additional ref - cleared on tidyup...
         
         this.in_ch = new GLib.IOChannel.unix_new(standard_input);
         this.out_ch = new GLib.IOChannel.unix_new(standard_output);
@@ -426,7 +426,9 @@ public class Spawn : Object
     {
         string prop = (ch == this.out_ch) ? "output" : "stderr";
        // print("prop: " + prop);
-
+        if (this.pid < 0) {
+            return false; // spawn complete + closed... can't read any more.
+        }
         
         //print(JSON.stringify(ch, null,4));
         while (true) {