Re: How does one pipe output from process to text buffer? <-- FIXED



On Sun, 2006-12-31 at 05:43 +0000, tomas tuxteam de wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, Dec 30, 2006 at 12:15:33AM -0500, Tony Freeman wrote:
Thanks everyone, I have this working now :-)  Special thanks to Tomas!

happy it helped :-)

Still strange that it blocks, though. Perhaps
g_spawn_async_with_pipes(...) gives you channels in blocking mode (I'd
doubt that, but I don't know for sure).

You might try this out e.g. with

  g_io_channel_set_flags(gioout,
                         G_IO_FLAG_NONBLOCK | g_io_channel_get_flags(gioout)),
                         &err); /* or NULL, if you live on the edge */

right after the gioout = g_io_channel_unix_new(...)

Regards
- -- tomÃs

Thank you again!  That was exactly the answer :-)  The application does
not freeze at all now.

Excellent!


GPid pid;
gint stdout;
GIOChannel *gioout;
g_spawn_async_with_pipes( NULL, 
                ssh_command, 
                NULL, 
                G_SPAWN_SEARCH_PATH,
                NULL,
                NULL,
                &pid,
                NULL, &stdout, NULL,
                NULL );
gioout = g_io_channel_unix_new(stdout);
g_io_channel_set_flags(gioout, G_IO_FLAG_NONBLOCK, NULL);
g_io_channel_get_flags(gioout);


-- Tony





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