开发者

JavaScript Glib.spawn_async stdout file descriptor

I want to spawn a process using spawn_async in the GLib bindings in javascript in a gnome3 shell-extension.

I need something like the "standard_output=True" parameter in the python doc http://developer.gnome.org/pygobject/stable/glib-functions.html which, when enabled, returns a filedescriptor to stdout of the process. The python API and C API differ heavily in this point.

Unfortunately, I cannot find any precise documentation of the JS API to开发者_开发知识库 GTK anywhere, the official page doesn't even list it though the shell is written in js to big parts...

The background of my question is that I call a python script doing serial communication, since I saw no other way to let JS get its data from such a script but through spawning a process.

Do you have any guess how to get the stdout of a process started like this?


The pygobject documentation you referenced is for the static libraries. Since Seed works through GObject introspection, you're safer trusting the C documentation. (Seed is the GObject introspecting Java Script library)

Perhaps you can roll your own function that does what you want in C and expose it to Seed: http://developer.gnome.org/seed/stable/seed-Native-Functions.html


This page includes info about http://developer.gnome.org/seed/3.0/seed-Modules.html embedding/utilizing your "c-module" in the javascript. An example taken from the page:

hello = imports.hello;
hello.say_hello_to("Tim");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜