(command, argvs = [], options = defaultOptions)
| 8 | } |
| 9 | |
| 10 | function execa(command, argvs = [], options = defaultOptions) { |
| 11 | return new Promise((resolve, reject) => { |
| 12 | const cp = child_process.spawn(command, argvs, options) |
| 13 | cp.on('error', reject) |
| 14 | cp.on('close', (code) => { |
| 15 | if (code !== 0) { |
| 16 | const error = new Error(`Command failed with exit code ${code}`) |
| 17 | reject(error) |
| 18 | } else { |
| 19 | resolve() |
| 20 | } |
| 21 | }) |
| 22 | }) |
| 23 | } |
| 24 | |
| 25 | async function main() { |
| 26 | await execa('pnpm', ['install']) |