Spawn.vala
authorAlan Knowles <alan@akbkhome.com>
Sat, 4 Jan 2014 19:50:58 +0000 (03:50 +0800)
committerAlan Knowles <alan@akbkhome.com>
Sat, 4 Jan 2014 19:50:58 +0000 (03:50 +0800)
Spawn.vala

index e36e871..07c8749 100644 (file)
@@ -148,6 +148,12 @@ public class Spawn : Object
      * @property err_ch {GLib.IOChannel} stderr io channel
      */
     IOChannel err_ch = null;
+    
+    
+    int err_src = -1;
+    
+    int out_src = -1;
+    
     /**
      * 
      * @method run
@@ -217,27 +223,6 @@ public class Spawn : Object
            
                          
         
-        function tidyup()
-        {
-            if (this.pid > -1) {
-                Process.close_pid(this.pid); // hopefully kills it..
-                this.pid = -1;
-            }
-            if (_this.in_ch)  _this.in_ch.close();
-            if (_this.out_ch)  _this.out_ch.close();
-            if (_this.err_ch)  _this.err_ch.close();
-            // blank out channels
-            _this.in_ch = false;
-            _this.err_ch = false;
-            _this.out_ch = false;
-            // rmeove listeners !! important otherwise we kill the CPU
-            if (this.err_src !== false) GLib.source_remove(this.err_src);
-            if (this.out_src !== false) GLib.source_remove(this.out_src);
-            this.err_src = false;
-            this.out_src = false;
-            
-        }
-        
         
         this.in_ch = new GLib.IOChannel.unix_new(ret.standard_input);
         this.out_ch = new GLib.IOChannel.unix_new(ret.standard_output);
@@ -328,6 +313,31 @@ public class Spawn : Object
         return this;
     
     },
+    
+    
+
+    private void tidyup()
+    {
+       if (this.pid > -1) {
+           Process.close_pid(this.pid); // hopefully kills it..
+           this.pid = -1;
+       }
+       if (this.in_ch)  this.in_ch.close();
+       if (this.out_ch)  this.out_ch.close();
+       if (this.err_ch)  this.err_ch.close();
+       // blank out channels
+       this.in_ch = false;
+       this.err_ch = false;
+       this.out_ch = false;
+       // rmeove listeners !! important otherwise we kill the CPU
+       if (this.err_src !== false) GLib.source_remove(this.err_src);
+       if (this.out_src !== false) GLib.source_remove(this.out_src);
+       this.err_src = false;
+       this.out_src = false;
+       
+    }
+    
+    
     /**
      * write to stdin of process
      * @arg str {String} string to write to stdin of process