From 06d77cbf1df6b015ce31dc8dcc0d81e4b6f00992 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Fri, 2 May 2014 18:27:06 +0800 Subject: [PATCH] Spawn.vala --- Spawn.vala | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/Spawn.vala b/Spawn.vala index afe1cad9..09334f3c 100644 --- a/Spawn.vala +++ b/Spawn.vala @@ -253,37 +253,37 @@ public class Spawn : Object - this.in_ch = new GLib.IOChannel.unix_new(ret.standard_input); - this.out_ch = new GLib.IOChannel.unix_new(ret.standard_output); - this.err_ch = new GLib.IOChannel.unix_new(ret.standard_error); + this.in_ch = new GLib.IOChannel.unix_new(standard_input); + this.out_ch = new GLib.IOChannel.unix_new(standard_output); + this.err_ch = new GLib.IOChannel.unix_new(standard_error); // make everything non-blocking! + + // using NONBLOCKING only works if io_add_watch + //returns true/false in right conditions + this.in_ch.set_flags (GLib.IOFlags.NONBLOCK); + this.out_ch.set_flags (GLib.IOFlags.NONBLOCK); + this.err_ch.set_flags (GLib.IOFlags.NONBLOCK); + - // using NONBLOCKING only works if io_add_watch - //returns true/false in right conditions - this.in_ch.set_flags (GLib.IOFlags.NONBLOCK); - this.out_ch.set_flags (GLib.IOFlags.NONBLOCK); - this.err_ch.set_flags (GLib.IOFlags.NONBLOCK); - - - - // add handlers for output and stderr. - - this.out_src = this.out_ch.add_watch ( - IOCondition.OUT | IOCondition.IN | IOCondition.PRI | IOCondition.HUP | IOCondition.ERR , - (channel, condition) => { - return this.read(_this.out_ch); - } - ); + + // add handlers for output and stderr. + + this.out_src = this.out_ch.add_watch ( + IOCondition.OUT | IOCondition.IN | IOCondition.PRI | IOCondition.HUP | IOCondition.ERR , + (channel, condition) => { + return this.read(_this.out_ch); + } + ); this.err_src = this.err_ch.add_watch ( IOCondition.OUT | IOCondition.IN | IOCondition.PRI | IOCondition.HUP | IOCondition.ERR , - (channel, condition) => { - return this.read(_this.err_ch); - } - ); - + (channel, condition) => { + return this.read(_this.err_ch); + } + ); + // call input.. if (this.pid > -1) { -- 2.39.2