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(...)


g_io_channel_...() could be buffering the input/output.  try adding a
g_io_channel_set_encoding(gioout, NULL, NULL); after the
g_io_channel_new() call.  Also, the following text may provide some
insight.

"The default encoding for GIOChannel is UTF-8. If your application is
reading output from a command using via pipe, you may need to set the
encoding to the encoding of the current locale (see g_get_charset())
with the g_io_channel_set_encoding() function.

If you want to read raw binary data without interpretation, then call
the g_io_channel_set_encoding() function with NULL for the encoding
argument."

James,


Regards
- -- tomÃs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFl04NBcgs9XrR2kYRAlG+AJ9LCauFArjjFzraf0GTLQ4Z+6oOUQCdFYt6
US5gnFcIbPS44N0OoxYrvA4=
=8p1T
-----END PGP SIGNATURE-----

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



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