mirror of https://github.com/actions/toolkit
try rmSync
parent
91f0c9b7d0
commit
665b756702
|
@ -345,18 +345,18 @@ describe('rmRF', () => {
|
||||||
|
|
||||||
const fd = await fs.open(filePath, 'r')
|
const fd = await fs.open(filePath, 'r')
|
||||||
|
|
||||||
// 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 {
|
// 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 io.rmRF(testPath)
|
// await io.rmRF(testPath)
|
||||||
} catch (err) {
|
// } catch (err) {
|
||||||
expect(err.code).toBe('EPERM')
|
// expect(err.code).toBe('EPERM')
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
await io.rmRF(testPath)
|
await io.rmRF(testPath)
|
||||||
await assertNotExists(testPath)
|
await assertNotExists(testPath)
|
||||||
}
|
// }
|
||||||
|
|
||||||
await fd.close()
|
await fd.close()
|
||||||
await io.rmRF(testPath)
|
await io.rmRF(testPath)
|
||||||
|
|
|
@ -17,6 +17,10 @@ export const {
|
||||||
unlink
|
unlink
|
||||||
} = fs.promises
|
} = fs.promises
|
||||||
|
|
||||||
|
export const {
|
||||||
|
rmSync
|
||||||
|
} = fs
|
||||||
|
|
||||||
export const IS_WINDOWS = process.platform === 'win32'
|
export const IS_WINDOWS = process.platform === 'win32'
|
||||||
|
|
||||||
export async function exists(fsPath: string): Promise<boolean> {
|
export async function exists(fsPath: string): Promise<boolean> {
|
||||||
|
|
|
@ -120,11 +120,11 @@ export async function rmRF(inputPath: string): Promise<void> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await ioUtil.rm(inputPath, {
|
ioUtil.rmSync(inputPath, {
|
||||||
force: true,
|
force: true,
|
||||||
maxRetries: 3,
|
maxRetries: 3,
|
||||||
recursive: true,
|
recursive: true,
|
||||||
retryDelay: 200
|
retryDelay: 300
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue