UNPKG

@polyfill-io-aot/builder

Version:

This is the builder module for polyfill-io-aot.

33 lines 982 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const spawn = require("cross-spawn"); const merge = require("lodash/merge"); /** @internal */ function xSpawn(cmd, args = [], opts = {}) { return new Promise((resolve, reject) => { const defaultOpts = { cwd: process.cwd(), env: process.env, stdio: 'inherit' }; const finalOptions = merge(defaultOpts, opts); let errored = false; const proc = spawn(cmd, args, finalOptions); proc.once('exit', (code) => { if (!errored) { if (code === 0) { resolve(); } else { reject(new Error(`Exited with code ${code}`)); } } }); proc.once('error', (e) => { errored = true; reject(e); }); }); } exports.xSpawn = xSpawn; //# sourceMappingURL=xSpawn.js.map