mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Tolerate ENOENT exceptions from files.realpath in isWithinProdPackage.
This commit is contained in:
@@ -482,8 +482,9 @@ export class NodeModulesDirectory {
|
||||
return true;
|
||||
}
|
||||
|
||||
const real = files.realpath(path);
|
||||
if (real !== path) {
|
||||
const real = realpathOrNull(path);
|
||||
if (typeof real === "string" &&
|
||||
real !== path) {
|
||||
// If node_modules/.bin/command is a symlink, determine the
|
||||
// answer by calling isWithinProdPackage(real).
|
||||
return isWithinProdPackage(real);
|
||||
@@ -521,6 +522,15 @@ export class NodeModulesDirectory {
|
||||
}
|
||||
}
|
||||
|
||||
function realpathOrNull(path) {
|
||||
try {
|
||||
return files.realpath(path);
|
||||
} catch (e) {
|
||||
if (e.code !== "ENOENT") throw e;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// File
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user