packages/core/lib/utils.js
function sh(cmd, exitOnError, cb) {
  const child = exec(cmd, {
    encoding: 'utf8',
    timeout: 1000 * 60 * 2, // 2 min; just want to make sure nothing gets detached forever.
  });
  let stdout = '';
  child.stdout.on('data', (data) => {
    stdout += data;
    process.stdout.write(data);
  });
  child.stderr.on('data', (data) => {
    process.stdout.write(data);
  });
  child.on('close', (code) => {
    if (code > 0) {
      if (exitOnError) {
        if (typeof cb === 'function') {
          cb(new Error(`Error with code ${code} after running: ${cmd}`));
        } else {
          process.stdout.write(`Error with code ${code} after running: ${cmd} \n`);
          process.exit(code);
        }
      } else {
        notifier.notify({
          title: cmd,
          message: stdout,
          sound: true,
        });
      }
    }
    if (typeof cb === 'function') cb();
  });
}
function sh(cmd, exitOnError, cb) {
  const child = exec(cmd, {
    encoding: 'utf8',
    timeout: 1000 * 60 * 2, // 2 min; just want to make sure nothing gets detached forever.
  });
  let stdout = '';
  child.stdout.on('data', (data) => {
    stdout += data;
    process.stdout.write(data);
  });
  child.stderr.on('data', (data) => {
    process.stdout.write(data);
  });
  child.on('close', (code) => {
    if (code > 0) {
      if (exitOnError) {
        if (typeof cb === 'function') {
          cb(new Error(`Error with code ${code} after running: ${cmd}`));
        } else {
          process.stdout.write(`Error with code ${code} after running: ${cmd} \n`);
          process.exit(code);
        }
      } else {
        notifier.notify({
          title: cmd,
          message: stdout,
          sound: true,
        });
      }
    }
    if (typeof cb === 'function') cb();
  });
}
Run shell command
@param cmd {string} - Command to run
@param exitOnError {boolean} - If that should exit non-zero or carry one.
@param cb {function} - Callback to fire when done.