mirror of https://github.com/actions/toolkit
pull/1344/head
parent
4d807985ec
commit
6de6f42334
|
@ -6,7 +6,6 @@ import * as io from '../src/io'
|
||||||
|
|
||||||
describe('cp', () => {
|
describe('cp', () => {
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
console.log('beforeAll')
|
|
||||||
await io.rmRF(getTestTemp())
|
await io.rmRF(getTestTemp())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -329,12 +328,10 @@ describe('rmRF', () => {
|
||||||
const filePath = path.join(testPath, 'file.txt')
|
const filePath = path.join(testPath, 'file.txt')
|
||||||
await fs.appendFile(filePath, 'some data')
|
await fs.appendFile(filePath, 'some data')
|
||||||
await assertExists(filePath)
|
await assertExists(filePath)
|
||||||
console.log('before remove while open')
|
|
||||||
const fd = await fs.open(filePath, 'r')
|
const fd = await fs.open(filePath, 'r')
|
||||||
await io.rmRF(testPath)
|
await io.rmRF(testPath)
|
||||||
|
|
||||||
await assertNotExists(testPath)
|
await assertNotExists(testPath)
|
||||||
console.log('before remove after closed')
|
|
||||||
await fd.close()
|
await fd.close()
|
||||||
await io.rmRF(testPath)
|
await io.rmRF(testPath)
|
||||||
await assertNotExists(testPath)
|
await assertNotExists(testPath)
|
||||||
|
|
|
@ -127,7 +127,6 @@ export async function rmRF(inputPath: string): Promise<void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log('a')
|
|
||||||
await ioUtil.rm(inputPath, {
|
await ioUtil.rm(inputPath, {
|
||||||
force: true,
|
force: true,
|
||||||
maxRetries: 3,
|
maxRetries: 3,
|
||||||
|
@ -194,19 +193,16 @@ export async function rmRF(inputPath: string): Promise<void> {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||||
// other errors are valid
|
// other errors are valid
|
||||||
console.log('b')
|
console.log(err)
|
||||||
if (err.code !== 'ENOENT') throw err
|
if (err.code !== 'ENOENT') throw err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shelling out fails to remove a symlink folder with missing source, this unlink catches that
|
// Shelling out fails to remove a symlink folder with missing source, this unlink catches that
|
||||||
try {
|
try {
|
||||||
console.log('c')
|
|
||||||
if (await ioUtil.exists(inputPath)) {
|
if (await ioUtil.exists(inputPath)) {
|
||||||
console.log('d')
|
|
||||||
await ioUtil.unlink(inputPath)
|
await ioUtil.unlink(inputPath)
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('e')
|
|
||||||
// if you try to delete a file that doesn't exist, desired result is achieved
|
// if you try to delete a file that doesn't exist, desired result is achieved
|
||||||
// other errors are valid
|
// other errors are valid
|
||||||
if (err.code !== 'ENOENT' || err.code !== 'EPERM') throw err
|
if (err.code !== 'ENOENT' || err.code !== 'EPERM') throw err
|
||||||
|
|
Loading…
Reference in New Issue