@arc-fusion/cli
Version:
CLI for running Arc Fusion on your local machine
32 lines (25 loc) • 721 B
JavaScript
const childProcess = require('child_process')
async function spawn (cmd, args, options) {
return new Promise((resolve, reject) => {
const sigintListener = () => {
reject(new Error('received SIGINT'))
}
process.once('SIGINT', sigintListener)
const proc = (/^win/i.test(process.platform))
? childProcess.spawn('cmd', ['/s', '/c', cmd].concat(args), options)
: childProcess.spawn(cmd, args, options)
proc.on('close', (code) => {
process.removeListener('SIGINT', sigintListener)
if (code === 0) {
resolve()
} else {
reject(code)
}
})
})
}
process.on('unhandledRejection', (_) => {
// swallow
})
module.exports = spawn