/
githubmirror
/
yarn
Обзор
Документация
Войти
/
githubmirror
/
yarn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
scripts/_runCommand.js
32 строки
910 B
Simon Vocella
Delete eslint-plugin-prettify and revert back to custom scripts for prettier (#3426)
17 май 2017, 15:07
17 май 2017, 15:07
1b21157
Код
Авторство
О чём код?
/** * Copyright (c) 2014, Facebook, Inc. All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ 'use strict'; const spawn = require('child_process').spawnSync; const chalk = require('chalk'); module.exports = function runCommand(cmd, args, cwd) { if (!cwd) { cwd = __dirname; } const displayArgs = args.length > 25 ? args.slice(0, 25) + '...' : args.join(' '); console.log(chalk.dim('$ cd ' + cwd + `\n$ ${cmd} ${displayArgs}\n`)); const result = spawn(cmd, args, { cwd, stdio: 'inherit', }); if (result.error || result.status !== 0) { const message = 'Error running command.'; const error = new Error(message); error.stack = message; throw error; } };