Re: fork in callbacks



Rodrigo Moya writes:
 > Well, what I want to do is to execve a process and capture its output (that
 > is stdio and return code). Is there a better solution?

Not AFAIK.

libgnorba/orbitgtk.c uses a fork for a trivial read from a child.

libgnomeui/gtkspell.c gives a more elaborate example reading lots
of data from a child over a long period.

If you want to read from the child over a long period then you 
might want to convert its stdout fd into a gdk input so that it 
can be polled along with the X connection (see gdk.c:gdk_add_input).

If you are developing the child process yourself then you might
consider using a CORBA interface instead of piping information
over stdio. I beleive that gtkspell is going to be converted 
into a CORBA interface in the future.

Felix



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]