Fix tmpdir in Windows

This commit is contained in:
Ashcon Partovi
2024-06-20 08:53:01 -07:00
parent 3a08c2198e
commit 3133fbe3fc

View File

@@ -695,14 +695,14 @@ function getTmpdir() {
if (isWindows) {
for (const key of ["TMPDIR", "TEMP", "TEMPDIR", "TMP", "RUNNER_TEMP"]) {
const tmpdir = process.env[key] || "";
if (!/^\/[a-z]\//i.test(tmpdir)) {
continue;
}
// HACK: There are too many bugs with cygwin directories.
// We should probably run Windows tests in both cygwin and powershell.
if (/cygwin|cygdrive/i.test(tmpdir)) {
continue;
}
if (!/^[a-z]/i.test(tmpdir)) {
continue;
}
const driveLetter = tmpdir[1];
return normalizeWindows(`${driveLetter.toUpperCase()}:${tmpdir.substring(2)}`);
}