Skip to content

Commit f5af8fd

Browse files
committed
fixup! Tread a failing opendir as an empty dir
1 parent 3debb0c commit f5af8fd

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/host/src/node/path-utils.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,16 @@ export async function findNodeApiModulePaths(
342342
);
343343
}
344344
}
345-
} catch {
346-
// Intentionally left empty: if the directory cannot be read, we skip it
345+
} catch (error) {
346+
if (
347+
error instanceof Error &&
348+
"code" in error &&
349+
(error.code === "ENOENT" || error.code === "EACCES")
350+
) {
351+
// Gracefully handling issues with reading directories
352+
return [];
353+
}
354+
throw error;
347355
}
348356
const childResults = await Promise.all(pendingResults);
349357
result.push(...childResults.flatMap((filePath) => filePath));

0 commit comments

Comments
 (0)