On Sat, 2007-03-10 at 16:22 -0500, steve wrote:
I'm trying to implement the ipsec connection startup command
I'm using the function g_spawn_async_with_pipes to call the ipsec binary
with the appropriate args.
The process will terminate when successful.
I want to pipe the output of the process (stdout) to a Status window
(pop-up widget??) in real-time.
For debugging? Otherwise it's better to send meaningful error messages
along with the failure signals that the VPN daemon sends to NM.
I'm thinking I need to use a GIOChannel to capture the output this way.
Can anyone clarify?
example:
code
GFILE *output = g_fopen(//dev//stdout, r);
GIOChannel *connOutput = NULL;
gchar * stdout_buffer;
connOutput = g_io_channel_unix_new(output);
while (g_io_channel_read_line(connOutput, stdout_buffer, NULL, NULL,
error) != (G_IO_STATUS_EOF || G_IO_STATUS_ERROR))
{
nm_status_update(%s, stdout_buffer); //pseudo function for now
if (stdout_buffer == \n\n)
{
g_io_channel_close(connOutput);
g_fclose(output);
g_free(stdout_buffer);
return 0:
}
}
.
/code
Does that make any sense or am I going about this the wrong way?
I think what you actually want to do is to spawn your process and
specify your own file descriptors for stdout and stderr. See
supplicant_exec() in src/nm-device-802-11-wireless.c of the
NETWORKMANAGER_0_6_0_RELEASE branch.
Dan
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list