Skip to content

Commit 716441d

Browse files
committed
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.)
1 parent b0c2860 commit 716441d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/harness/harnessIO.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ namespace Harness {
7272

7373
for (const file of fs.readdirSync(folder)) {
7474
const pathToFile = pathModule.join(folder, file);
75+
if (!fs.existsSync(pathToFile)) continue; // ignore invalid symlinks
7576
const stat = fs.statSync(pathToFile);
7677
if (options.recursive && stat.isDirectory()) {
7778
paths = paths.concat(filesInFolder(pathToFile));

0 commit comments

Comments
 (0)