From 716441d343faa15417ec558c60addfc6a2e75a3d Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Fri, 9 Apr 2021 05:08:39 -0400 Subject: [PATCH] Process only existing files and directories in the test harness `fs.statSync` throws `ENOENT` if there is a symlink to a nonexistent target. This can be avoided by checking that the entry exists before using it. (This is annoying when editing tests in Emacs, since it keeps lock files for modified-but-unsaved files, which are `.#foo` symlinks to a nonexistent target.) --- src/harness/harnessIO.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/harness/harnessIO.ts b/src/harness/harnessIO.ts index f556b6e47f6..48ad549d4ef 100644 --- a/src/harness/harnessIO.ts +++ b/src/harness/harnessIO.ts @@ -72,6 +72,7 @@ namespace Harness { for (const file of fs.readdirSync(folder)) { const pathToFile = pathModule.join(folder, file); + if (!fs.existsSync(pathToFile)) continue; // ignore invalid symlinks const stat = fs.statSync(pathToFile); if (options.recursive && stat.isDirectory()) { paths = paths.concat(filesInFolder(pathToFile));