How to use the execa.shellSync function in execa

To help you get started, we’ve selected a few execa examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github webex / react-widgets / scripts / utils / git.js View on Github external
exports.lastLog = function lastLog() {
  // When we're running on Jenkins, we know there's an env var called GIT_COMMIT
  const treeLike = process.env.GIT_COMMIT || 'HEAD';
  const cmd = `git log -n 1 --format=%B ${treeLike}`;

  debug(`Shelling out to ${cmd}`);
  const {stdout} = shellSync(cmd);

  debug('Done');

  return stdout;
};
github soixantecircuits / altruist / actions / print.js View on Github external
function listAvailablePrinters () {
  var printers = execa.shellSync("lpstat -a | awk '{print $1}'").stdout
  console.log('Available printers are:\n' + printers)
}
github prisma-labs / graphqlgen / packages / create-graphqlgen / src / loader.ts View on Github external
const generateGraphQLGenStarterModels = async (path: string): Promise => {
  const spinner = ora(`Generating models 👷‍`).start()

  process.chdir(path)

  try {
    if (await isYarnInstalled()) {
      await execa.shellSync('yarn generate', { stdio: `ignore` })
    } else {
      await execa.shellSync('npm run generate', { stdio: `ignore` })
    }

    spinner.succeed()
  } catch (err) {
    spinner.fail()
  }
}
github webex / react-widgets / scripts / utils / exec.js View on Github external
function execSync(command) {
  return shellSync(command, {stdio: 'inherit'});
}
github TryGhost / Ghost-CLI / extensions / systemd / systemd.js View on Github external
static willRun() {
        try {
            execa.shellSync('which systemctl', {stdio: 'ignore'});
            return true;
        } catch (e) {
            return false;
        }
    }
}
github KuangPF / vue-cli-analysis / packages / @vue / cli-upgrade / get-upgradable-version.js View on Github external
function getMaxSatisfying (packageName, range) {
  let version = JSON.parse(
    execa.shellSync(`npm view ${packageName}@${range} version --json`).stdout
  )

  if (typeof version !== 'string') {
    version = version[0]
  }

  return version
}
github smallbatch-apps / crab / libs / utils.js View on Github external
const checkGlobalDependencies = async (args) => {

  if (args.command === 'create') {
    try {
      const { stdout } = execa.shellSync('parcel --version');
    } catch(error) {
      if (error.code === 127) {
        await installParcel();
      }
    }

    if (args.typescript) {
      try {
        const { stdout } = execa.shellSync('tsc --version');
      } catch(error) {
        if (error.code === 127) {
          await installTypeScript();
        }
      }
    }
  }