(command: string, args: string[])
| 30 | } |
| 31 | |
| 32 | function runCommand(command: string, args: string[]) { |
| 33 | return new Promise<void>((resolve, reject) => { |
| 34 | const child = spawn(command, args, { |
| 35 | cwd: process.cwd(), |
| 36 | stdio: 'inherit', |
| 37 | env: process.env, |
| 38 | }) |
| 39 | |
| 40 | child.on('error', reject) |
| 41 | child.on('exit', (code, signal) => { |
| 42 | if (code === 0) { |
| 43 | resolve() |
| 44 | return |
| 45 | } |
| 46 | |
| 47 | reject( |
| 48 | new Error( |
| 49 | signal |
| 50 | ? `${command} exited with signal ${signal}` |
| 51 | : `${command} exited with code ${code ?? 'unknown'}`, |
| 52 | ), |
| 53 | ) |
| 54 | }) |
| 55 | }) |
| 56 | } |
| 57 | |
| 58 | export async function ensureElectronBinary() { |
| 59 | const binaryPath = tryResolveElectronBinary() |
no test coverage detected