mirror of
https://github.com/github/codeql-action.git
synced 2026-01-06 22:50:17 +08:00
Merge branch 'main' into only-output-on-failure
This commit is contained in:
@@ -389,7 +389,11 @@ export function getToolNames(sarifContents: string): string[] {
|
||||
// Mostly intended for use within tests.
|
||||
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);
|
||||
const realSubdir = path.join(tmpDir, 'real');
|
||||
fs.mkdirSync(realSubdir);
|
||||
const symlinkSubdir = path.join(tmpDir, 'symlink');
|
||||
fs.symlinkSync(realSubdir, symlinkSubdir, 'dir');
|
||||
const result = await body(symlinkSubdir);
|
||||
fs.rmdirSync(tmpDir, { recursive: true });
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user