From cf3dd065b8bdc38aa24319052f35499510f0e035 Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Mon, 20 Feb 2023 14:59:12 +0000 Subject: [PATCH] Add default value and rename args --- packages/cache/src/internal/cacheUtils.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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: {