From 534600c1ff026b60260738b66a89af7c9fb7a68d Mon Sep 17 00:00:00 2001 From: Asher Date: Tue, 20 Aug 2019 19:16:44 -0500 Subject: [PATCH] Don't error when scanning nonexistent extension dir --- scripts/vscode.patch | 19 ++++++++++++++++--- src/server.ts | 2 ++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/scripts/vscode.patch b/scripts/vscode.patch index b303182a..3c113924 100644 --- a/scripts/vscode.patch +++ b/scripts/vscode.patch @@ -278,7 +278,7 @@ index 9373b22383..a98ff4723c 100644 constructor(private _args: ParsedArgs, private _execPath: string) { if (!process.env['VSCODE_LOGS']) { diff --git a/src/vs/platform/extensionManagement/node/extensionManagementService.ts b/src/vs/platform/extensionManagement/node/extensionManagementService.ts -index 70cd46c824..33d661644b 100644 +index 70cd46c824..3a38a91d8b 100644 --- a/src/vs/platform/extensionManagement/node/extensionManagementService.ts +++ b/src/vs/platform/extensionManagement/node/extensionManagementService.ts @@ -725,11 +725,15 @@ export class ExtensionManagementService extends Disposable implements IExtension @@ -320,7 +320,20 @@ index 70cd46c824..33d661644b 100644 .then(([uninstalled, extensions]) => { extensions = extensions.filter(e => !uninstalled[new ExtensionIdentifierWithVersion(e.identifier, e.manifest.version).key()]); if (excludeOutdated) { -@@ -806,7 +817,7 @@ export class ExtensionManagementService extends Disposable implements IExtension +@@ -768,6 +779,12 @@ export class ExtensionManagementService extends Disposable implements IExtension + private scanExtensions(root: string, type: ExtensionType): Promise { + const limiter = new Limiter(10); + return pfs.readdir(root) ++ .catch((error) => { ++ if (error.code !== 'ENOENT') { ++ throw error; ++ } ++ return []; ++ }) + .then(extensionsFolders => Promise.all(extensionsFolders.map(extensionFolder => limiter.queue(() => this.scanExtension(extensionFolder, root, type))))) + .then(extensions => extensions.filter(e => e && e.identifier)); + } +@@ -806,7 +823,7 @@ export class ExtensionManagementService extends Disposable implements IExtension private async removeUninstalledExtensions(): Promise { const uninstalled = await this.getUninstalledExtensions(); @@ -329,7 +342,7 @@ index 70cd46c824..33d661644b 100644 const installed: Set = new Set(); for (const e of extensions) { if (!uninstalled[new ExtensionIdentifierWithVersion(e.identifier, e.manifest.version).key()]) { -@@ -825,7 +836,7 @@ export class ExtensionManagementService extends Disposable implements IExtension +@@ -825,7 +842,7 @@ export class ExtensionManagementService extends Disposable implements IExtension } private removeOutdatedExtensions(): Promise { diff --git a/src/server.ts b/src/server.ts index 48fbb334..28b2a1a0 100644 --- a/src/server.ts +++ b/src/server.ts @@ -481,6 +481,8 @@ export class MainServer extends Server { util.promisify(fs.readFile)(filePath, "utf8"), this.servicesPromise, ]); + const logger = this.services.get(ILogService) as ILogService; + logger.info("request.url", `"${request.url}"`); const environment = this.services.get(IEnvironmentService) as IEnvironmentService; const locale = environment.args.locale || await getLocaleFromConfig(environment.userDataPath); const cwd = process.env.VSCODE_CWD || process.cwd();