fix flakey tests

This commit is contained in:
KingKDot
2026-03-17 01:09:32 -05:00
parent f2216d91b0
commit 1631801232
@@ -85,6 +85,7 @@ function streamFileAndDelete(tmpPath: string): ReadableStream<Uint8Array> {
const cleanup = async () => {
if (cleaned) return;
cleaned = true;
try { await reader.cancel(); } catch {}
await fs.unlink(tmpPath).catch(() => {});
};
@@ -93,8 +94,8 @@ function streamFileAndDelete(tmpPath: string): ReadableStream<Uint8Array> {
try {
const { done, value } = await reader.read();
if (done) {
controller.close();
await cleanup();
controller.close();
return;
}
if (value) {