We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4244355 commit beddb4bCopy full SHA for beddb4b
lib/fs.js
@@ -2731,6 +2731,14 @@ function realpathSync(p, options) {
2731
}
2732
resolvedLink = pathModule.resolve(previous, linkTarget);
2733
2734
+ // If resolvedLink is not valid or is a pipe/socket, stop resolving, break out of the loop
2735
+ // issue: https://github.com/nodejs/node/issues/54200
2736
+ const resolvedLinkStats = binding.lstat(resolvedLink, false, undefined, false /* throwIfNoEntry */);
2737
+ if (!resolvedLinkStats || isFileType(resolvedLinkStats, S_IFIFO) ||
2738
+ isFileType(resolvedLinkStats, S_IFSOCK)) {
2739
+ break;
2740
+ }
2741
+
2742
cache?.set(base, resolvedLink);
2743
if (!isWindows) seenLinks.set(id, linkTarget);
2744
0 commit comments