Re: Capture console app output into texview?



On Thu, Nov 19, 2009 at 10:11 PM, Till Harbaum / Lists <lists harbaum org>wrote:

Hi,

i am trying to run a text mode application in the background of my gtk one
and display its output in a textview. I know this is supposed to be done
using g_spawn_async_with_pipes and then link to the output via
g_io_add_watch. I even got something that sort of works, but the output is
very much delayed and comes in chunks and worse, the CPU load is at max
while and after i run my code.

Are there any examples for doing this? There must be many programs doing
something similar to run e.g. some little helper program or similar.

Can you consider using the VteTerminal[1] widget? This is the same terminal
widget used in gnome-terminal and in Ubuntu/Debian graphical frontends to
dpkg. It lets you embed a ternimal that you can bind to any program, you're
not forced to bind it to a shell.

VteTerminal will take care of monitoring your process and grabbing all
output for you. The only drawback is that the widget doesn't work on win32.

[1] http://library.gnome.org/devel/vte/unstable/VteTerminal.html

Emmanuel Rodriguez



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