UNPKG

453 BJavaScriptView Raw
1const
2 { log, fatal } = require('./logger')
3 spawn = require('cross-spawn')
4
5module.exports = function (cmd, params, cwd) {
6 log(`Running "${cmd} ${params.join(' ')}"`)
7 console.log()
8
9 const runner = spawn.sync(
10 cmd,
11 params,
12 { stdio: 'inherit', stdout: 'inherit', stderr: 'inherit', cwd }
13 )
14
15 if (runner.status || runner.error) {
16 console.log()
17 fatal(`⚠️ Command "${cmd}" failed with exit code: ${runner.status}`)
18 }
19}