Re: Capturing Output of a Command from an Extension



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 <xtranophilist gmail com> 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 :)



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