firmament-vita
Version:
Firmament module for automating VITA tasks
52 lines • 2.03 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var child_process_1 = require("child_process");
var firmament_yargs_1 = require("firmament-yargs");
var VitaSpawnImpl = (function (_super) {
__extends(VitaSpawnImpl, _super);
function VitaSpawnImpl() {
return _super !== null && _super.apply(this, arguments) || this;
}
VitaSpawnImpl.prototype.spawnIt = function (cmd, args, cbStatus, cbFinal) {
cbStatus = this.checkCallback(cbStatus);
cbFinal = this.checkCallback(cbFinal);
var stderrText = '';
var childProcess = child_process_1.spawn(cmd, args);
childProcess.stderr.on('data', function (dataChunk) {
stderrText += dataChunk.toString();
});
childProcess.stdout.on('data', function (dataChunk) {
try {
cbStatus(null, dataChunk);
}
catch (err) {
var e = err;
}
});
childProcess.on('error', function (code) {
var c = code;
});
childProcess.on('close', function (code, signal) {
if (code) {
cbFinal(new Error("exitCode: " + code + ", signal: " + signal + ", stderr: " + stderrText), null);
}
else {
cbFinal(null, null);
}
});
return childProcess;
};
return VitaSpawnImpl;
}(firmament_yargs_1.ForceErrorImpl));
exports.VitaSpawnImpl = VitaSpawnImpl;
//# sourceMappingURL=vita-spawn-impl.js.map