mirror of
https://github.com/webinstall/webi-installers.git
synced 2026-02-14 17:49:53 +00:00
28 lines
673 B
JavaScript
28 lines
673 B
JavaScript
'use strict';
|
|
|
|
var spawn = require('child_process').spawn;
|
|
|
|
function spawner(args) {
|
|
return new Promise(function (resolve, reject) {
|
|
var bin = args.shift();
|
|
var runner = spawn(bin, args, {
|
|
windowsHide: true,
|
|
});
|
|
runner.stdout.on('data', function (chunk) {
|
|
console.info(chunk.toString('utf8'));
|
|
});
|
|
runner.stderr.on('data', function (chunk) {
|
|
console.error(chunk.toString('utf8'));
|
|
});
|
|
runner.on('exit', function (code) {
|
|
if (0 !== code) {
|
|
reject(new Error("exited with non-zero status code '" + code + "'"));
|
|
return;
|
|
}
|
|
resolve({ code: code });
|
|
});
|
|
});
|
|
}
|
|
|
|
module.exports = spawner;
|