mirror of https://github.com/actions/toolkit
pull/1344/head
parent
d589c08bf4
commit
eed631025c
|
@ -344,12 +344,15 @@ describe('rmRF', () => {
|
||||||
await assertExists(filePath)
|
await assertExists(filePath)
|
||||||
|
|
||||||
const fd = await fs.open(filePath, 'r')
|
const fd = await fs.open(filePath, 'r')
|
||||||
await io.rmRF(testPath)
|
|
||||||
|
|
||||||
// can't remove folder with locked file on windows
|
// can't remove folder with locked file on windows
|
||||||
if (ioUtil.IS_WINDOWS) {
|
if (ioUtil.IS_WINDOWS) {
|
||||||
|
try {
|
||||||
// additionally, can't stat an open file on Windows without getting EPERM
|
// additionally, can't stat an open file on Windows without getting EPERM
|
||||||
await ioUtil.access(filePath)
|
await io.rmRF(testPath)
|
||||||
|
} catch (err) {
|
||||||
|
expect(err.code).toBe('EPERM')
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
await assertNotExists(testPath)
|
await assertNotExists(testPath)
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,6 @@ 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(err)
|
|
||||||
if (err.code !== 'ENOENT') throw err
|
if (err.code !== 'ENOENT') throw err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue