mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Tolerate ENOENT errors in Builder#copyDirectory.
This commit is contained in:
@@ -174,6 +174,14 @@ export function dirtyNodeModulesDirectory(nodeModulesDir) {
|
||||
|
||||
export const optimisticStatOrNull = makeOptimistic("statOrNull", statOrNull);
|
||||
export const optimisticLStat = makeOptimistic("lstat", lstat);
|
||||
export const optimisticLStatOrNull = makeOptimistic("lstatOrNull", path => {
|
||||
try {
|
||||
return optimisticLStat(path);
|
||||
} catch (e) {
|
||||
if (e.code !== "ENOENT") throw e;
|
||||
return null;
|
||||
}
|
||||
});
|
||||
export const optimisticReadFile = makeOptimistic("readFile", readFile);
|
||||
export const optimisticReaddir = makeOptimistic("readdir", readdir);
|
||||
export const optimisticHashOrNull = makeOptimistic("hashOrNull", (...args) => {
|
||||
|
||||
@@ -6,7 +6,7 @@ import {Profile} from '../tool-env/profile.js';
|
||||
import {
|
||||
optimisticReadFile,
|
||||
optimisticReaddir,
|
||||
optimisticLStat,
|
||||
optimisticLStatOrNull,
|
||||
} from "../fs/optimistic.js";
|
||||
|
||||
// Builder is in charge of writing "bundles" to disk, which are
|
||||
@@ -497,9 +497,11 @@ Previous builder: ${previousBuilder.outputPath}, this builder: ${outputPath}`
|
||||
return cachedExternalPath = isExternal && real;
|
||||
};
|
||||
|
||||
let fileStatus = optimisticLStat(thisAbsFrom);
|
||||
let fileStatus = optimisticLStatOrNull(thisAbsFrom);
|
||||
|
||||
if (! symlink && fileStatus.isSymbolicLink()) {
|
||||
if (! symlink &&
|
||||
fileStatus &&
|
||||
fileStatus.isSymbolicLink()) {
|
||||
// If copyDirectory is not allowed to create symbolic links to
|
||||
// external files, and this file is a symbolic link that points
|
||||
// to an external file, update fileStatus so that we copy this
|
||||
@@ -512,9 +514,9 @@ Previous builder: ${previousBuilder.outputPath}, this builder: ${outputPath}`
|
||||
|
||||
// Update fileStatus to match the actual file rather than the
|
||||
// symbolic link, thus forcing the file to be copied below.
|
||||
fileStatus = optimisticLStat(externalPath);
|
||||
fileStatus = optimisticLStatOrNull(externalPath);
|
||||
|
||||
if (fileStatus.isDirectory()) {
|
||||
if (fileStatus && fileStatus.isDirectory()) {
|
||||
// Update _currentRealRootDir so that we can judge
|
||||
// isExternal relative to this new root directory when
|
||||
// traversing nested directories.
|
||||
@@ -523,6 +525,11 @@ Previous builder: ${previousBuilder.outputPath}, this builder: ${outputPath}`
|
||||
}
|
||||
}
|
||||
|
||||
if (! fileStatus) {
|
||||
// If the file did not exist, skip it.
|
||||
return;
|
||||
}
|
||||
|
||||
let itemForMatch = item;
|
||||
const isDirectory = fileStatus.isDirectory();
|
||||
if (isDirectory) {
|
||||
|
||||
Reference in New Issue
Block a user