/
githubmirror
/
atom
Обзор
Документация
Войти
/
githubmirror
/
atom
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v1.48.0
script/lib/spawn-sync.js
22 строки
831 B
Rafael Oleza
Reformat all JS files using prettier
31 май 2019, 19:33
31 май 2019, 19:33
7f3f040
Код
Авторство
О чём код?
// This file exports a function that has the same interface as // `spawnSync`, but it throws if there's an error while executing // the supplied command or if the exit code is not 0. This is similar to what // `execSync` does, but we want to use `spawnSync` because it provides automatic // escaping for the supplied arguments. const childProcess = require('child_process'); module.exports = function() { const result = childProcess.spawnSync.apply(childProcess, arguments); if (result.error) { throw result.error; } else if (result.status !== 0) { if (result.stdout) console.error(result.stdout.toString()); if (result.stderr) console.error(result.stderr.toString()); throw new Error( `Command ${result.args.join(' ')} exited with code "${result.status}"` ); } else { return result; } };