Permalink
Browse files

fs: cache non-symlinks in realpathSync.

Extend `fs.realpathSync` to cache the results for paths that are not
symlinks in addition to caching symlink mappings.

PR-URL: #10253
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information...
1 parent 10b3297 commit 6629f8f83f01f8c6e3ee8116722f65a416a14e1c @yallop yallop committed with evanlucas Dec 12, 2016
Showing with 1 addition and 0 deletions.
  1. +1 −0 lib/fs.js
View
@@ -1532,6 +1532,7 @@ fs.realpathSync = function realpathSync(p, options) {
var stat = fs.lstatSync(base);
if (!stat.isSymbolicLink()) {
knownHard[base] = true;
+ if (cache) cache.set(base, base);
continue;
}

0 comments on commit 6629f8f

Please sign in to comment.