fix: tmpdir cleanup removes contained files (#8826)

This commit is contained in:
Johann150 2022-06-14 16:00:10 +02:00 committed by GitHub
parent e4dc25dd5c
commit 3a42fe50c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -11,9 +11,14 @@ export function createTemp(): Promise<[string, () => void]> {
export function createTempDir(): Promise<[string, () => void]> {
return new Promise<[string, () => void]>((res, rej) => {
tmp.dir((e, path, cleanup) => {
if (e) return rej(e);
res([path, cleanup]);
});
tmp.dir(
{
unsafeCleanup: true,
},
(e, path, cleanup) => {
if (e) return rej(e);
res([path, cleanup]);
}
);
});
}