提交 f8f03286 编写于 作者: B Benjamin Pasero

ENOENT errors with file event avalanche (fixes #4350)

上级 10927a86
......@@ -411,7 +411,7 @@ export class FileService implements files.IFileService {
let absolutePath = this.toAbsolutePath(resource);
return pfs.stat(absolutePath).then((stat: fs.Stats) => {
return new StatResolver(resource, stat.isDirectory(), stat.mtime.getTime(), stat.size);
return new StatResolver(resource, stat.isDirectory(), stat.mtime.getTime(), stat.size, this.options.verboseLogging);
});
}
......@@ -627,8 +627,9 @@ export class StatResolver {
private mime: string;
private etag: string;
private size: number;
private verboseLogging: boolean;
constructor(resource: uri, isDirectory: boolean, mtime: number, size: number) {
constructor(resource: uri, isDirectory: boolean, mtime: number, size: number, verboseLogging: boolean) {
assert.ok(resource && resource.scheme === 'file', 'Invalid resource: ' + resource);
this.resource = resource;
......@@ -638,6 +639,8 @@ export class StatResolver {
this.mime = !this.isDirectory ? baseMime.guessMimeTypes(resource.fsPath).join(', ') : null;
this.etag = etag(size, mtime);
this.size = size;
this.verboseLogging = verboseLogging;
}
public resolve(options: files.IResolveFileOptions): TPromise<files.IFileStat> {
......@@ -688,7 +691,9 @@ export class StatResolver {
private resolveChildren(absolutePath: string, absoluteTargetPaths: string[], resolveSingleChildDescendants: boolean, callback: (children: files.IFileStat[]) => void): void {
extfs.readdir(absolutePath, (error: Error, files: string[]) => {
if (error) {
console.error(error);
if (this.verboseLogging) {
console.error(error);
}
return callback(null); // return - we might not have permissions to read the folder
}
......@@ -701,7 +706,9 @@ export class StatResolver {
flow.sequence(
function onError(error: Error): void {
console.error(error);
if (this.verboseLogging) {
console.error(error);
}
clb(null, null); // return - we might not have permissions to read the folder or stat the file
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册