( cmd: string, args: string[], env?: NodeJS.ProcessEnv, stdin?: string, )
| 310 | } |
| 311 | |
| 312 | export async function execAndCaptureError( |
| 313 | cmd: string, |
| 314 | args: string[], |
| 315 | env?: NodeJS.ProcessEnv, |
| 316 | stdin?: string, |
| 317 | ): Promise<Error> { |
| 318 | try { |
| 319 | await _exec({ env, stdin }, cmd, args); |
| 320 | throw new Error('Tried to capture subprocess exception, but it completed successfully.'); |
| 321 | } catch (err) { |
| 322 | if (err instanceof Error) { |
| 323 | return err; |
| 324 | } |
| 325 | throw new Error('Subprocess exception was not an Error instance'); |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | export async function execAndWaitForOutputToMatch( |
| 330 | cmd: string, |
no test coverage detected