From 9410a2928ce7b6e38b3a0b4f04217a931f1eb4d7 Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Thu, 1 Mar 2018 14:54:09 -0800 Subject: [PATCH] :bug: handle error conditions --- src/client/providers/jediProxy.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/client/providers/jediProxy.ts b/src/client/providers/jediProxy.ts index 194134b949d8..fcf9b7c7e523 100644 --- a/src/client/providers/jediProxy.ts +++ b/src/client/providers/jediProxy.ts @@ -218,8 +218,11 @@ export class JediProxy implements vscode.Disposable { return; } pidusage.stat(this.proc.pid, async (err, result) => { + if (err) { + return console.error('Python Extension: (pidusage)', err); + } const limit = Math.min(Math.max(this.pythonSettings.jediMemoryLimit, 1024), 8192); - if (result.memory > limit * 1024 * 1024) { + if (result && result.memory > limit * 1024 * 1024) { this.logger.logWarning(`IntelliSense process memory consumption exceeded limit of ${limit} MB and process will be restarted.\nThe limit is controlled by the 'python.jediMemoryLimit' setting.`); await this.restartLanguageServer(); }