how to read from UnixInputStream
- From: binbin <fatcamera gmail com>
- To: gnome-shell-list gnome org
- Subject: how to read from UnixInputStream
- Date: Tue, 13 Dec 2011 21:11:18 +0800
I'm tring to spawn a command and read its output. In the sync way, I
find imports.gi.GLib.spawn_command_line_sync is fine. But in the async
way, I cannot find any information on dealing with the unix file
descriptor.
try the code below:
glib = imports.gi.GLib;
cmd = 'uname -a';
[success,argc,argv] = glib.shell_parse_argv(cmd);
[success,pid,stdin,stdout,stderr] =
glib.spawn_async_with_pipes(null,argv,null,glib.SpawnFlags.SEARCH_PATH,null,null);
gio = imports.gi.Gio;
stream = new gio.UnixInputStream({fd:stdout});
we can get a UnixInputStream, but I don't know how to use the read
method. The g_input_stream_read indicates that there should be 3
parameters, a buffer(void*), a count(gsize), a cancellable
object(GCancellable). Then, what's the corressponding type for void* in
gjs?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]