Skip to content

Commit 2a04ce9

Browse files
authored
handle error conditions when checking memory usage of jedi language server process
Fixes #926
1 parent d9e42b0 commit 2a04ce9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/client/providers/jediProxy.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,11 @@ export class JediProxy implements vscode.Disposable {
218218
return;
219219
}
220220
pidusage.stat(this.proc.pid, async (err, result) => {
221+
if (err) {
222+
return console.error('Python Extension: (pidusage)', err);
223+
}
221224
const limit = Math.min(Math.max(this.pythonSettings.jediMemoryLimit, 1024), 8192);
222-
if (result.memory > limit * 1024 * 1024) {
225+
if (result && result.memory > limit * 1024 * 1024) {
223226
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.`);
224227
await this.restartLanguageServer();
225228
}

0 commit comments

Comments
 (0)