fix: adopt fs api changes
This commit is contained in:
parent
ef62374ef7
commit
0cb6aa508a
|
@ -44,7 +44,7 @@ async function rimraf(path: string, mode = RimRafMode.UNLINK): Promise<void> {
|
|||
throw new Error('rimraf - will refuse to recursively delete root');
|
||||
}
|
||||
|
||||
// delete: via rmDir
|
||||
// delete: via rm
|
||||
if (mode === RimRafMode.UNLINK) {
|
||||
return rimrafUnlink(path);
|
||||
}
|
||||
|
@ -72,7 +72,9 @@ async function rimrafMove(path: string): Promise<void> {
|
|||
}
|
||||
|
||||
async function rimrafUnlink(path: string): Promise<void> {
|
||||
return Promises.rmdir(path, { recursive: true, maxRetries: 3 });
|
||||
// Use rm instead of rmdir for
|
||||
// https://github.com/nodejs/node/commit/9948036ee0
|
||||
return promisify(fs.rm)(path, { recursive: true, force: true, maxRetries: 3 });
|
||||
}
|
||||
|
||||
export function rimrafSync(path: string): void {
|
||||
|
@ -80,7 +82,9 @@ export function rimrafSync(path: string): void {
|
|||
throw new Error('rimraf - will refuse to recursively delete root');
|
||||
}
|
||||
|
||||
fs.rmdirSync(path, { recursive: true });
|
||||
// Use rmSync instead of rmdirSync for
|
||||
// https://github.com/nodejs/node/commit/9948036ee0
|
||||
fs.rmSync(path, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
|
|
@ -280,7 +280,8 @@ flakySuite('PFS', function () {
|
|||
const linkTarget = await Promises.readlink(targetLinkMD5JSFolderLinked);
|
||||
assert.strictEqual(linkTarget, targetLinkMD5JSFolder);
|
||||
|
||||
await Promises.rmdir(targetLinkTestFolder, { recursive: true });
|
||||
// Ref https://github.com/nodejs/node/commit/0ddd75bcd816a8e5f4e27411b8e913abb92c2ed5
|
||||
await Promises.rm(targetLinkTestFolder);
|
||||
}
|
||||
|
||||
// Copy with `preserveSymlinks: false` and verify result
|
||||
|
|
Loading…
Reference in a new issue