missing refs, slight change to completion provider
[roobuilder] / src / Spawn.vala
index c80da5c..3e09e1f 100644 (file)
@@ -235,7 +235,7 @@ public class Spawn : Object
                                this.ctx = null;
                        }
                        this.tidyup();
-                       //print("DONE TIDYUP");
+                       GLib.debug("DONE TIDYUP - calling complete");
                        
                        this.complete(this.result, this.output, this.stderr);
                        
@@ -319,6 +319,27 @@ public class Spawn : Object
     
     }
     
+    public async int run_async()
+    {
+               GLib.MainLoop loop = new GLib.MainLoop ();
+               this.complete.connect( (res, str,  stderr) => {
+                       loop.quit ();
+               });
+               try {
+                       this.run();
+               } catch (GLib.Error e) {
+                       return -1;
+               }
+               
+                
+               loop.run ();
+               return this.result;
+
+    
+    
+    }
+    
+    
     
 
     public void tidyup() // or kill