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 () => { const cleanup = async () => {
if (cleaned) return; if (cleaned) return;
cleaned = true; cleaned = true;
try { await reader.cancel(); } catch {}
await fs.unlink(tmpPath).catch(() => {}); await fs.unlink(tmpPath).catch(() => {});
}; };
@@ -93,8 +94,8 @@ function streamFileAndDelete(tmpPath: string): ReadableStream<Uint8Array> {
try { try {
const { done, value } = await reader.read(); const { done, value } = await reader.read();
if (done) { if (done) {
controller.close();
await cleanup(); await cleanup();
controller.close();
return; return;
} }
if (value) { if (value) {