It can be done as:

const GLib = imports.gi.GLib;
GLib.spawn_command_line_sync('pwd');


On Tue, Jul 12, 2011 at 20:55, xtranophilist aaa <[email protected]>wrote:

> How do I capture the output of a command?
> One way could be running command with Util.spawn that redirects output to a
> file using '>' or using tee command. And then read the file with
> GLib.file_get_contents().
> But I couldn't make the command output to file work right.
> There should be a way to directly get output into a variable as string.
> Please help!
> Thank you :)
>
_______________________________________________
gnome-shell-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gnome-shell-list

Reply via email to