(
command: string,
args: readonly string[],
options: RunCommandOptions = {},
)
| 5 | } |
| 6 | |
| 7 | export async function runCommand( |
| 8 | command: string, |
| 9 | args: readonly string[], |
| 10 | options: RunCommandOptions = {}, |
| 11 | ): Promise<string> { |
| 12 | const p = new Subprocess(command, args, options); |
| 13 | |
| 14 | try { |
| 15 | return await p.output(); |
| 16 | } catch (e) { |
| 17 | if (e instanceof SubprocessError) { |
| 18 | // old behavior of just throwing the stdout/stderr strings |
| 19 | throw e.output ? e.output : e.cause ? `${e.message} ${e.cause.toString()}` : e.code ? e.code : 'Unknown error'; |
| 20 | } |
| 21 | |
| 22 | throw e; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | export async function getCommandOutput( |
| 27 | command: string, |
no test coverage detected