mirror of https://github.com/actions/toolkit
Check if tool path exists before executing (#385)
parent
1e88dec883
commit
34f71e80ce
|
@ -461,7 +461,7 @@ describe('@actions/tool-cache', function() {
|
||||||
]
|
]
|
||||||
await exec.exec(`"${powershellPath}"`, args)
|
await exec.exec(`"${powershellPath}"`, args)
|
||||||
} else {
|
} else {
|
||||||
const zipPath: string = await io.which('zip')
|
const zipPath: string = await io.which('zip', true)
|
||||||
await exec.exec(`"${zipPath}`, [zipFile, '-r', '.'], {cwd: stagingDir})
|
await exec.exec(`"${zipPath}`, [zipFile, '-r', '.'], {cwd: stagingDir})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,7 +512,7 @@ describe('@actions/tool-cache', function() {
|
||||||
]
|
]
|
||||||
await exec.exec(`"${powershellPath}"`, args)
|
await exec.exec(`"${powershellPath}"`, args)
|
||||||
} else {
|
} else {
|
||||||
const zipPath: string = await io.which('zip')
|
const zipPath: string = await io.which('zip', true)
|
||||||
await exec.exec(zipPath, [zipFile, '-r', '.'], {cwd: stagingDir})
|
await exec.exec(zipPath, [zipFile, '-r', '.'], {cwd: stagingDir})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,7 +569,7 @@ describe('@actions/tool-cache', function() {
|
||||||
]
|
]
|
||||||
await exec.exec(`"${powershellPath}"`, args)
|
await exec.exec(`"${powershellPath}"`, args)
|
||||||
} else {
|
} else {
|
||||||
const zipPath: string = await io.which('zip')
|
const zipPath: string = await io.which('zip', true)
|
||||||
await exec.exec(zipPath, [zipFile, '-r', '.'], {cwd: stagingDir})
|
await exec.exec(zipPath, [zipFile, '-r', '.'], {cwd: stagingDir})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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}')`
|
const command = `$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}')`
|
||||||
|
|
||||||
// run powershell
|
// run powershell
|
||||||
const powershellPath = await io.which('powershell')
|
const powershellPath = await io.which('powershell', true)
|
||||||
const args = [
|
const args = [
|
||||||
'-NoLogo',
|
'-NoLogo',
|
||||||
'-Sta',
|
'-Sta',
|
||||||
|
@ -294,7 +294,7 @@ async function extractZipWin(file: string, dest: string): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function extractZipNix(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})
|
await exec(`"${unzipPath}"`, [file], {cwd: dest})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue