| 192 | } |
| 193 | |
| 194 | run() { |
| 195 | const promise = !this.exists() ? this.install(true) : Promise.resolve() |
| 196 | |
| 197 | promise |
| 198 | .then(() => { |
| 199 | const [, , ...args] = process.argv |
| 200 | |
| 201 | const options = { cwd: process.cwd(), stdio: 'inherit' } |
| 202 | |
| 203 | // Ignore SIGINT and SIGTERM so the child process handles them |
| 204 | // and exits gracefully |
| 205 | process.on('SIGINT', () => {}) |
| 206 | process.on('SIGTERM', () => {}) |
| 207 | |
| 208 | const result = spawnSync(this.binaryPath, args, options) |
| 209 | |
| 210 | if (result.error) { |
| 211 | error(result.error) |
| 212 | } |
| 213 | |
| 214 | process.exit(result.status) |
| 215 | }) |
| 216 | .catch((e) => { |
| 217 | error(e.message) |
| 218 | process.exit(1) |
| 219 | }) |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | const getOS = () => { |