diff --git a/packages/cache/src/internal/cacheUtils.ts b/packages/cache/src/internal/cacheUtils.ts index 0ab64eae..8de857f4 100644 --- a/packages/cache/src/internal/cacheUtils.ts +++ b/packages/cache/src/internal/cacheUtils.ts @@ -71,13 +71,12 @@ export async function unlinkFile(filePath: fs.PathLike): Promise { return util.promisify(fs.unlink)(filePath) } -async function getVersion(app: string, args?: string[]): Promise { +async function getVersion(app: string, additionalArgs: string[] = []): Promise { let versionOutput = '' - typeof args !== 'undefined' ? args : (args = []) - args.push('--version') - core.debug(`Checking ${app} ${args.join(' ')}`) + additionalArgs.push('--version') + core.debug(`Checking ${app} ${additionalArgs.join(' ')}`) try { - await exec.exec(`${app}`, args, { + await exec.exec(`${app}`, additionalArgs, { ignoreReturnCode: true, silent: true, listeners: {