Multiple g_spawn_async_with_pipes
- From: Neil Hodge <neh attbi com>
- To: gtk-app-devel-list <gtk-app-devel-list gnome org>
- Subject: Multiple g_spawn_async_with_pipes
- Date: 25 Feb 2003 06:53:25 -0800
All:
I have the following basic setup:
if (g_spawn_async_with_pipes (dir, argv, NULL,
G_SPAWN_FILE_AND_ARGV_ZERO,
NULL,
NULL,
&child_pid, NULL, &pout, &perr,
&err))
{
channel = g_io_channel_unix_new (pout);
g_io_add_watch (channel, G_IO_IN | G_IO_HUP | G_IO_ERR |
G_IO_NVAL, io_dialog, buffer);
g_io_channel_unref (channel);
channel = g_io_channel_unix_new (perr);
g_io_add_watch (channel, G_IO_IN | G_IO_HUP | G_IO_ERR |
G_IO_NVAL, io_dialog, buffer);
g_io_channel_unref (channel);
} else {
[DO ERROR STUFF]
}
static gboolean
io_dialog (GIOChannel * channel, GIOCondition condition, gpointer data)
{
gchar *text, *text_utf8;
gint len;
gssize bytes_written;
if (condition & G_IO_IN) {
[PROCESS PIPE]
return TRUE;
}
return FALSE;
}
and it is working fine. What I need to be able to do is call multiple
processes with g_spawn_async_with_pipes, but have each call block on the
preceding call to g_spawn_async_with_pipes. It seems like I could place
a second call to g_spawn_async_with_pipes in io_dialog, but if I have
more than two or three of these, this would get way too unwieldy. Is
there some way to tell one call to g_spawn_async_with_pipes (or any
other command, for that matter) to block (given the pid) on a previous
call to g_spawn_async_with_pipes? Alternately, I could build up my
command line as follows:
command1; command2
although I am not sure this will work with exec(). Any ideas? Thanks.
Neil
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]