Skip to content

Commit 5bbadba

Browse files
authored
Ensure dispatch_checks.py cleans up venvs when running in CI (#42933)
1 parent af79e6b commit 5bbadba

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

eng/scripts/dispatch_checks.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import sys
55
import time
66
import signal
7+
import shutil
78
from dataclasses import dataclass
89
from typing import List
910

@@ -76,6 +77,16 @@ async def run_check(semaphore: asyncio.Semaphore, package: str, check: str, base
7677
print(header.replace('OUTPUT', 'STDERR'))
7778
print(stderr.rstrip())
7879
print(trailer)
80+
81+
# if we have any output collections to complete, do so now here
82+
83+
# finally, we need to clean up any temp dirs created by --isolate
84+
if in_ci():
85+
isolate_dir = os.path.join(package, f".venv_{check}")
86+
try:
87+
shutil.rmtree(isolate_dir)
88+
except:
89+
logger.warning(f"Failed to remove isolate dir {isolate_dir} for {package} / {check}")
7990
return CheckResult(package, check, exit_code, duration, stdout, stderr)
8091

8192

0 commit comments

Comments
 (0)