- print("PID: " + this.pid);
- }
-
- ChildWatch.add (this.pid, (w_pid, result) => {
-
- this.result = result;
- if (_this.debug) {
- print("child_watch_add : result: " + result);
- }
-
- this.read(this.out_ch);
- this.read(this.err_ch);
-
-
- Process.close_pid(this.pid);
- this.pid = -1;
- if (this.ctx) {
- this.ctx.quit();
- }
- this.tidyup();
- //print("DONE TIDYUP");
- if (this.cfg.finish) {
- this.cfg.finish(this.result);
- }
- });
-
-
-
- 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;