async function runCmd()

in index.js [175:188]


async function runCmd (cmd, options = {}) {
    options = Object.assign({}, options, { stdio: 'inherit', shell: true });
    return new Promise((resolve, reject) => {
        const [command, ...args] = cmd.split(' ');
        const process = spawn(command, args, options);
        process.on('close', code => {
            if (code === 0) {
                resolve();
            } else {
                reject(new Error(`Command failed: ${cmd}`));
            }
        });
    });
}