mirror of https://github.com/actions/toolkit
mv rather than cp on non-windows
parent
7b617c260d
commit
8c202adf94
|
@ -431,11 +431,18 @@ 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)
|
||||||
// copy each child item. do not move. move can fail on Windows
|
if (IS_WINDOWS) {
|
||||||
// due to anti-virus software having an open handle on a file.
|
// copy each child item. do not move. move can fail on Windows
|
||||||
for (const itemName of fs.readdirSync(sourceDir)) {
|
// due to anti-virus software having an open handle on a file.
|
||||||
const s = path.join(sourceDir, itemName)
|
for (const itemName of fs.readdirSync(sourceDir)) {
|
||||||
await io.cp(s, destPath, {recursive: true})
|
const s = path.join(sourceDir, itemName)
|
||||||
|
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
|
||||||
|
@ -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}`)
|
||||||
await io.cp(sourceFile, 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)
|
||||||
|
} else {
|
||||||
|
await io.mv(sourceFile, destPath)
|
||||||
|
}
|
||||||
|
|
||||||
// write .complete
|
// write .complete
|
||||||
_completeToolPath(tool, version, arch)
|
_completeToolPath(tool, version, arch)
|
||||||
|
|
Loading…
Reference in New Issue