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);