GitRepo.vala
[gitlive] / GitRepo.vala
index 6f9ffb4..2a3035a 100644 (file)
@@ -274,10 +274,12 @@ public class GitRepo : Object
         
     }
     
-    public delegate void PullAsyncCallback (string str)
-    async public string pull_async(PullAsyncCallback cb) {
+    public delegate void GitAsyncCallback (string str);
+    public string pull_async(GitAsyncCallback cb) 
+    {
     
-         
+        string[] cmd = { "pull" , "--no-edit" };
+        return this.git_async( cmd , cb);
     
     }
     
@@ -351,7 +353,7 @@ public class GitRepo : Object
     }
        
        
-       public string git_async(string[] args_in ) throws Error, SpawnError
+       public string git_async( string[] args_in,   GitAsyncCallback cb ) throws Error, SpawnError
     {
         // convert arguments.
         
@@ -385,12 +387,14 @@ public class GitRepo : Object
         
 
         var cfg = new SpawnConfig(this.git_working_dir , args , env);
-        
+        cfg.async = true;
+       
 
        // may throw error...
         var sp = new Spawn(cfg);
-      
-
+        sp.run(((err) => {
+               cb(sp.output);
+        });
         stdout.printf( "GOT: %s\n" , sp.output);
         // parse output for some commands ?
         return sp.output;