Don't make temporary directories symlinks

`toolcache.extractTar` currently falls over when `ACTIONS_TEMP` contains
a symlink, and the runner no longer exists, so it's unlikely our
customers would be running with temporary directories that contain
symlinks.
This commit is contained in:
Henry Mercer
2022-06-17 14:07:36 -07:00
parent 30681e79db
commit c2fd5d10f6
3 changed files with 3 additions and 11 deletions

View File

@@ -112,11 +112,7 @@ export async function withTmpDir<T>(
body: (tmpDir: string) => Promise<T>
): Promise<T> {
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "codeql-action-"));
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);
const result = await body(tmpDir);
await del(tmpDir, { force: true });
return result;
}