( toolCommand: string, cwd?: string )
| 67 | }; |
| 68 | |
| 69 | export const getCommandOutput = async ( |
| 70 | toolCommand: string, |
| 71 | cwd?: string |
| 72 | ): Promise<string> => { |
| 73 | let {stdout, stderr, exitCode} = await exec.getExecOutput( |
| 74 | toolCommand, |
| 75 | undefined, |
| 76 | {ignoreReturnCode: true, ...(cwd && {cwd})} |
| 77 | ); |
| 78 | |
| 79 | if (exitCode) { |
| 80 | stderr = !stderr.trim() |
| 81 | ? `The '${toolCommand}' command failed with exit code: ${exitCode}` |
| 82 | : stderr; |
| 83 | throw new Error(stderr); |
| 84 | } |
| 85 | |
| 86 | return stdout.trim(); |
| 87 | }; |
| 88 | |
| 89 | export const getCommandOutputNotEmpty = async ( |
| 90 | toolCommand: string, |
no outgoing calls
no test coverage detected