src/helpers.js
function execCmd(cmd, allowedErrors = []) {
  debug(`About to execute cmd: ${cmd} with allowed errors: ${JSON.stringify(allowedErrors)}`);
  return exec(cmd, {})
    .then((result) => {
      debug(`Executed successfully cmd: ${cmd}: `, result.stdout);
      const { stdout } = result;
      return stdout;
    })
    .catch((error) => {
      debug(`Executed with error cmd: ${cmd}: `, error.stdout, error.stderr);
      if (allowedErrors.some(allowedError => allowedError.test(error.stderr))) {
        return Promise.resolve(error.stderr);
      }
      return Promise.reject(error);
    });
}
function execCmd(cmd, allowedErrors = []) {
  debug(`About to execute cmd: ${cmd} with allowed errors: ${JSON.stringify(allowedErrors)}`);
  return exec(cmd, {})
    .then((result) => {
      debug(`Executed successfully cmd: ${cmd}: `, result.stdout);
      const { stdout } = result;
      return stdout;
    })
    .catch((error) => {
      debug(`Executed with error cmd: ${cmd}: `, error.stdout, error.stderr);
      if (allowedErrors.some(allowedError => allowedError.test(error.stderr))) {
        return Promise.resolve(error.stderr);
      }
      return Promise.reject(error);
    });
}
function execCmd ( cmd , allowedErrors = [ ] ) { debug ( ` ${ cmd } ${ JSON . stringify ( allowedErrors ) } ` ) ; return exec ( cmd , { } ) . then ( ( result ) => { debug ( ` ${ cmd } ` , result . stdout ) ; const { stdout } = result ; return stdout ; } ) . catch ( ( error ) => { debug ( ` ${ cmd } ` , error . stdout , error . stderr ) ; if ( allowedErrors . some ( allowedError => allowedError . test ( error . stderr ) ) ) { return Promise . resolve ( error . stderr ) ; } return Promise . reject ( error ) ; } ) ; }
Helper function to exec commands.
Helper function to exec commands .