Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if tool path exists before executing #385

Merged
merged 1 commit into from
Apr 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/tool-cache/__tests__/tool-cache.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ describe('@actions/tool-cache', function() {
]
await exec.exec(`"${powershellPath}"`, args)
} else {
const zipPath: string = await io.which('zip')
const zipPath: string = await io.which('zip', true)
await exec.exec(`"${zipPath}`, [zipFile, '-r', '.'], {cwd: stagingDir})
}

Expand Down Expand Up @@ -512,7 +512,7 @@ describe('@actions/tool-cache', function() {
]
await exec.exec(`"${powershellPath}"`, args)
} else {
const zipPath: string = await io.which('zip')
const zipPath: string = await io.which('zip', true)
await exec.exec(zipPath, [zipFile, '-r', '.'], {cwd: stagingDir})
}

Expand Down Expand Up @@ -569,7 +569,7 @@ describe('@actions/tool-cache', function() {
]
await exec.exec(`"${powershellPath}"`, args)
} else {
const zipPath: string = await io.which('zip')
const zipPath: string = await io.which('zip', true)
await exec.exec(zipPath, [zipFile, '-r', '.'], {cwd: stagingDir})
}

Expand Down
4 changes: 2 additions & 2 deletions packages/tool-cache/src/tool-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ async function extractZipWin(file: string, dest: string): Promise<void> {
const command = `$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}')`

// run powershell
const powershellPath = await io.which('powershell')
const powershellPath = await io.which('powershell', true)
const args = [
'-NoLogo',
'-Sta',
Expand All @@ -294,7 +294,7 @@ async function extractZipWin(file: string, dest: string): Promise<void> {
}

async function extractZipNix(file: string, dest: string): Promise<void> {
const unzipPath = await io.which('unzip')
const unzipPath = await io.which('unzip', true)
await exec(`"${unzipPath}"`, [file], {cwd: dest})
}

Expand Down