3 var pkg = require('../package.json');
4 var spawn = require('child_process').spawn;
5 var os = require('os');
6 var path = require('path');
8 function spawner(args) {
9 return new Promise(function (resolve, reject) {
10 var bin = args.shift();
11 var runner = spawn(bin, args, {
14 runner.stdout.on('data', function (chunk) {
15 console.info(chunk.toString('utf8'));
17 runner.stderr.on('data', function (chunk) {
18 console.error(chunk.toString('utf8'));
20 runner.on('exit', function (code) {
22 reject(new Error("exited with non-zero status code '" + code + "'"));
25 resolve({ code: code });
30 module.exports = spawner;