MCPcopy Index your code
hub / github.com/actions/setup-node / getCommandOutput

Function getCommandOutput

src/cache-utils.ts:69–87  ·  view source on GitHub ↗
(
  toolCommand: string,
  cwd?: string
)

Source from the content-addressed store, hash-verified

67};
68
69export 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
89export const getCommandOutputNotEmpty = async (
90 toolCommand: string,

Callers 3

cache-utils.tsFile · 0.85
getCommandOutputNotEmptyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected