From cec811a629d68a029fd3ccbe4be93a8b38b33d63 Mon Sep 17 00:00:00 2001 From: SukkaW Date: Tue, 23 Jul 2024 18:06:30 +0800 Subject: [PATCH] Fix: do not use file handle yet --- Build/lib/create-file.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Build/lib/create-file.ts b/Build/lib/create-file.ts index 6f33b9b1..3c4a5be2 100644 --- a/Build/lib/create-file.ts +++ b/Build/lib/create-file.ts @@ -4,7 +4,6 @@ import picocolors from 'picocolors'; import type { Span } from '../trace'; import path from 'path'; import fs from 'fs'; -import fsp from 'fs/promises'; import { sort } from './timsort'; import { fastStringArrayJoin } from './misc'; import { readFileByLine } from './fetch-text-by-line'; @@ -21,11 +20,9 @@ export async function compareAndWriteFile(span: Span, linesA: string[], filePath console.log(`Nothing to write to ${filePath}...`); isEqual = false; } else { - const fd = await fsp.open(filePath); - isEqual = await span.traceChildAsync(`comparing ${filePath}`, async () => { let index = 0; - for await (const lineB of readFileByLine(fd)) { + for await (const lineB of readFileByLine(filePath)) { const lineA = linesA[index] as string | undefined; index++; @@ -60,8 +57,6 @@ export async function compareAndWriteFile(span: Span, linesA: string[], filePath return true; }); - - await fd.close(); } if (isEqual) {