qbs build: Add convenience function for reading process output.

Change-Id: I998ec20de032b59448585c851e79912010cdac08
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
This commit is contained in:
Christian Kandeler
2014-06-27 15:46:55 +02:00
committed by Joerg Bornemann
parent 99f43c94c6
commit 60abd3f0a1

View File

@@ -0,0 +1,11 @@
var Process = loadExtension("qbs.Process")
function readOutput(executable, args)
{
var p = new Process();
var output = "";
if (p.exec(executable, args, false) !== -1)
output = p.readStdOut().trim(); // Trailing newline.
p.close();
return output;
}