From 129024b02d183a9a42abf7ce0c7528fcdc695743 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 8 Jan 2024 21:29:29 +0100 Subject: [PATCH] Update specUtils.ts --- sources/specUtils.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sources/specUtils.ts b/sources/specUtils.ts index d40f286a3..e3dc05a8f 100644 --- a/sources/specUtils.ts +++ b/sources/specUtils.ts @@ -90,7 +90,7 @@ export async function loadSpec(initialCwd: string): Promise { manifestPath: string; } | null = null; - let file: FileHandle; + let content: string; while (nextCwd !== currCwd && (!selection || !selection.data.packageManager)) { currCwd = nextCwd; @@ -101,15 +101,12 @@ export async function loadSpec(initialCwd: string): Promise { const manifestPath = path.join(currCwd, `package.json`); try { - file = await fs.promises.open(manifestPath, `r`); + content = await fs.promises.readFile(manifestPath, `utf8`); } catch (err) { if ((err as NodeError)?.code === `ENOENT`) continue; throw err; } - const content = await file.readFile(`utf8`); - await file.close(); - let data; try { data = JSON.parse(content);