Re: libseed-list watching stdin



Alan Knowles wrote:
Finally got time to look at this.

This is an example using the old API - the one you are using. http://git.akbkhome.com/?p=gitlive;a=blob;f=Spawn.js

Yes, that's approximately how I did it. Nice class by the way, seems to be a better alternative than the multiprocessing module?

The new API has changed (most of the methods have moved into
GLib.IOChannel http://devel.akbkhome.com/seed/GLib.IOChannel.html

Ok, I see. Will the old API still be there?

I don't see any method to create an IOChannel from an existing fd though, something like 'new GLib.IOChannel.fd(n)' ?

For some of this to work, we need support for byte arrays using the
new introspection array syntax. - those methods also need correct
introspection hints.

What's that?

/Jonatan

Regards Alan

--- On 24/Jun/2010, Jonatan Liljedahl wrote:
This worked:

GLib.io_add_watch(stdin, 0, GLib.IOCondition.IN, watch_func);

And I had to use GString as buffer when reading:

var linebuf = new GLib.String; var codebuf = ""; var watch =
function(source, condition, data) { GLib.io_channel_read_line_string(source, linebuf); codebuf +=
linebuf.str; .... return true; }

It would be nice if also the other read-functions worked, those who
take a gchar pointer. How does Seed handle pointer-arguments?

Also, why does some stuff work in OOP style and some not? I created
the GString with "new GLib.String", but it doesn't seem to have any
methods. The IOChannel is created with GLib.io_channel_unix_new(),
since "new GLib.IOChannel" can't pass any filedescriptor. And the
returned IOChannel doesn't have any methods either. Is this because
both are only GLib and not GObject?

/Jonatan

Jonatan Liljedahl wrote:
What's the simplest way to have a watcher on stdin?

I tried something like GLib.io_channel_add_watch(GLib.io_channel_unix_new(1),1,my_func)
but get "ConversionError Can not convert Javascript value to
long".

/Jonatan

_______________________________________________ libseed-list
mailing list libseed-list gnome org http://mail.gnome.org/mailman/listinfo/libseed-list
_______________________________________________ libseed-list
mailing list libseed-list gnome org http://mail.gnome.org/mailman/listinfo/libseed-list

_______________________________________________ libseed-list mailing
list libseed-list gnome org http://mail.gnome.org/mailman/listinfo/libseed-list



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