From 08c122403d5634fc0de8502873cebf710ef43ab0 Mon Sep 17 00:00:00 2001 From: Yuri Per Date: Thu, 17 Dec 2020 13:11:34 +0200 Subject: [PATCH] Catch exception after lstat call lstat can fail on Windows because of file/directory permissions --- src/path-scanner.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/path-scanner.coffee b/src/path-scanner.coffee index 5bd83cd..2bb2cc3 100644 --- a/src/path-scanner.coffee +++ b/src/path-scanner.coffee @@ -96,7 +96,10 @@ class PathScanner extends EventEmitter stat: (filePath) -> # lstat is SLOW, but what other way to determine if something is a directory or file ? # also, sync is about 200ms faster than async... - stat = fs.lstatSync(filePath) + try + stat = fs.lstatSync(filePath) + catch e + return null if @options.follow and stat.isSymbolicLink() if @isInternalSymlink(filePath)