(
cmdFormat: string,
cmd: string,
options: exec.ExecOptions = {},
)
| 16 | } |
| 17 | |
| 18 | export async function getCmdOutput( |
| 19 | cmdFormat: string, |
| 20 | cmd: string, |
| 21 | options: exec.ExecOptions = {}, |
| 22 | ): Promise<string> { |
| 23 | cmd = cmdFormat.replace("{0}", cmd); |
| 24 | let stdout = ""; |
| 25 | let stderr = ""; |
| 26 | try { |
| 27 | await exec.exec(cmd, [], { |
| 28 | silent: true, |
| 29 | listeners: { |
| 30 | stdout(data) { |
| 31 | stdout += data.toString(); |
| 32 | }, |
| 33 | stderr(data) { |
| 34 | stderr += data.toString(); |
| 35 | }, |
| 36 | }, |
| 37 | ...options, |
| 38 | }); |
| 39 | } catch (e) { |
| 40 | (e as any).commandFailed = { |
| 41 | command: cmd, |
| 42 | stderr, |
| 43 | }; |
| 44 | throw e; |
| 45 | } |
| 46 | return stdout; |
| 47 | } |
| 48 | |
| 49 | export interface GhCache { |
| 50 | isFeatureAvailable: typeof ghCache.isFeatureAvailable; |
no outgoing calls
no test coverage detected