+/// # valac --pkg gio-2.0 --pkg gtk+-3.0 --pkg posix Spawn.vala -o /tmp/Spawn
using GLib;
+using Gtk;
// compile valac
-/// # valac --pkg gio-2.0 --pkg posix Spawn.vala -o /tmp/Spawn
///using Gee; // for array list?
}
- bool ctx = false; // the mainloop ctx.
+ MainLoop ctx = null; // the mainloop ctx.
/**
* @property output {String} resulting output
Process.close_pid(this.pid);
this.pid = -1;
- if (this.ctx) {
+ if (this.ctx != null) {
this.ctx.quit();
+ this.ctx = null;
}
this.tidyup();
//print("DONE TIDYUP");
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();
+ if (this.in_ch != null) this.in_ch.shutdown(true);
+ if (this.out_ch != null) this.out_ch.shutdown(true);
+ if (this.err_ch != null) this.err_ch.shutdown(true);
// blank out channels
- this.in_ch = false;
- this.err_ch = false;
- this.out_ch = false;
+ this.in_ch = null;
+ this.err_ch = null;
+ this.out_ch = null;
// rmeove listeners !! important otherwise we kill the CPU
- if (this.err_src > -1 ) GLib.source_remove(this.err_src);
- if (this.out_src > -1 ) GLib.source_remove(this.out_src);
+ //if (this.err_src > -1 ) GLib.source_remove(this.err_src);
+ //if (this.out_src > -1 ) GLib.source_remove(this.out_src);
this.err_src = -1;
this.out_src = -1;
} else {
this.stderr += buffer;
}
- _this[prop] += x.str_return;
- if (_this.debug) {
- print(prop + ':' + x.str_return.replace(/\n/, ''));
+ //_this[prop] += x.str_return;
+ if (this.cfg.debug) {
+ stdout.printf("%s : %s", prop , str_return);
}
- if (this.async) {
+ if (this.cfg.async) {
try {
- if (imports.gi.Gtk.events_pending()) {
- imports.gi.Gtk.main_iteration();
+ if ( Gtk.events_pending()) {
+ Gtk.main_iteration();
}
} catch(Error e) {