mirror of https://github.com/actions/toolkit
mv rather than cp on non-windows
parent
7b617c260d
commit
8c202adf94
|
@ -431,12 +431,19 @@ export async function cacheDir(
|
||||||
|
|
||||||
// Create the tool dir
|
// Create the tool dir
|
||||||
const destPath: string = await _createToolPath(tool, version, arch)
|
const destPath: string = await _createToolPath(tool, version, arch)
|
||||||
|
if (IS_WINDOWS) {
|
||||||
// copy each child item. do not move. move can fail on Windows
|
// copy each child item. do not move. move can fail on Windows
|
||||||
// due to anti-virus software having an open handle on a file.
|
// due to anti-virus software having an open handle on a file.
|
||||||
for (const itemName of fs.readdirSync(sourceDir)) {
|
for (const itemName of fs.readdirSync(sourceDir)) {
|
||||||
const s = path.join(sourceDir, itemName)
|
const s = path.join(sourceDir, itemName)
|
||||||
await io.cp(s, destPath, {recursive: true})
|
await io.cp(s, destPath, {recursive: true})
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
for (const itemName of fs.readdirSync(sourceDir)) {
|
||||||
|
const s = path.join(sourceDir, itemName)
|
||||||
|
await io.mv(s, destPath, {recursive: true})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// write .complete
|
// write .complete
|
||||||
_completeToolPath(tool, version, arch)
|
_completeToolPath(tool, version, arch)
|
||||||
|
@ -473,11 +480,16 @@ export async function cacheFile(
|
||||||
// create the tool dir
|
// create the tool dir
|
||||||
const destFolder: string = await _createToolPath(tool, version, arch)
|
const destFolder: string = await _createToolPath(tool, version, arch)
|
||||||
|
|
||||||
// copy instead of move. move can fail on Windows due to
|
|
||||||
// anti-virus software having an open handle on a file.
|
|
||||||
const destPath: string = path.join(destFolder, targetFile)
|
const destPath: string = path.join(destFolder, targetFile)
|
||||||
core.debug(`destination file ${destPath}`)
|
core.debug(`destination file ${destPath}`)
|
||||||
|
|
||||||
|
if (IS_WINDOWS) {
|
||||||
|
// copy instead of move. move can fail on Windows due to
|
||||||
|
// anti-virus software having an open handle on a file.
|
||||||
await io.cp(sourceFile, destPath)
|
await io.cp(sourceFile, destPath)
|
||||||
|
} else {
|
||||||
|
await io.mv(sourceFile, destPath)
|
||||||
|
}
|
||||||
|
|
||||||
// write .complete
|
// write .complete
|
||||||
_completeToolPath(tool, version, arch)
|
_completeToolPath(tool, version, arch)
|
||||||
|
|
Loading…
Reference in New Issue