mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 09:14:58 +00:00
Always clean-up temp dirs in withTmpDir
This commit is contained in:
@@ -84,9 +84,11 @@ export async function withTmpDir<T>(
|
||||
body: (tmpDir: string) => Promise<T>,
|
||||
): Promise<T> {
|
||||
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "codeql-action-"));
|
||||
const result = await body(tmpDir);
|
||||
await fs.promises.rm(tmpDir, { force: true, recursive: true });
|
||||
return result;
|
||||
try {
|
||||
return await body(tmpDir);
|
||||
} finally {
|
||||
await fs.promises.rm(tmpDir, { force: true, recursive: true });
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user