( tag: string, cmd: string | string[], options?: SpawnOptions )
| 65 | } |
| 66 | |
| 67 | export function execAsync( |
| 68 | tag: string, |
| 69 | cmd: string | string[], |
| 70 | options?: SpawnOptions |
| 71 | ): Promise<void> { |
| 72 | return new Promise((resolve, reject) => { |
| 73 | const childProcess = spawn(tag, cmd, options); |
| 74 | |
| 75 | childProcess.once('error', e => { |
| 76 | reject(e); |
| 77 | }); |
| 78 | |
| 79 | childProcess.once('exit', code => { |
| 80 | if (code === 0) { |
| 81 | resolve(); |
| 82 | } else { |
| 83 | reject(new Error(`Child process exits with non-zero code ${code}`)); |
| 84 | } |
| 85 | }); |
| 86 | }); |
| 87 | } |
| 88 | |
| 89 | export function exec( |
| 90 | tag: string, |
no test coverage detected