On 05/21/2010 02:06 AM, Lex Trotman wrote:
On 21 May 2010 02:49, Andrei Vishneuski
<vish@gravitysoft.org>
wrote:
Ok, thats where I thought it would be, I'm not sure why, maybe
its GTK2.18 or OSX pipes but whatever, can you try the attached patch
that tries to pick up more conditions to stop.
Debugging indicated that the section below starts getting condition =
G_IO_IN forever, but "g_io_channel_read_line" can read nothing.
I have tried to use additional reading method like read_char,
read_to_the_end. I have tried to flush pipe. None of it helped.
The result workaround I have used shown below:
if (cond & (G_IO_IN | G_IO_PRI))
{
gchar *msg;
+ int count = 0;
while (g_io_channel_read_line(ioc, &msg, NULL, NULL, NULL) && msg)
{
gint color = (GPOINTER_TO_INT(data)) ? COLOR_DARK_RED : COLOR_BLACK;
process_build_output_line(msg, color);
g_free(msg);
+ count++
}
+ if (count == 0) return FALSE;
}
It works, but doesn't give an answer why pipe says "there is still
something to read in the pipe".