(command: string, cwd?: string, rejectOnFailure?: boolean)
| 7 | export type CliChoice<T> = { name: string; value: T }; |
| 8 | |
| 9 | export function runCliCommand(command: string, cwd?: string, rejectOnFailure?: boolean): Promise<CommandResult> { |
| 10 | return new Promise((resolve, reject) => { |
| 11 | exec(command, { cwd: cwd, shell: getShell() }, (error, stdout, stderr) => { |
| 12 | const returnCode = error ? (error.code ?? 1) : 0; |
| 13 | if (returnCode !== 0 && rejectOnFailure) { |
| 14 | reject(new Error(stderr.trim())); |
| 15 | } else { |
| 16 | resolve({ returnCode, stdout, stderr }); |
| 17 | } |
| 18 | }); |
| 19 | }); |
| 20 | } |
| 21 | |
| 22 | export function spawnCliCommand( |
| 23 | command: string, |
no test coverage detected