Re: Running spawned program in background



On Monday 26 April 2004 19:43, William Dest wrote:

I am using g_spawn_command_line_sync to run a shell
script in an xterm window.  Of course, this runs as a
new process and leaves the GTK parent app unresponsive
and the screen elements don't get refreshed.  (...)
Is there a way to  make some gtk_.. (or any) function call 
that will keep  the parent app active if it gets focus before 
the  child app closes?

Why don't you use g_spawn_command_line_async() then? 

If you want the output of the program you spawn, use 
g_spawn_async_with_pipes() and read the program's output by reading from the 
stdout/stderr pipe file descriptors that you get back. You can find a short 
example on how to do that here: 
http://scentric.net/tmp/spawn-async-with-pipes-gtk.c

Cheers
 -Tim



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